Question

Can I use managed C# DLL in unmanaged Delphi EXE? Or the only way is to have managed DLL and EXE or unmanaged DLL and EXE?

Was it helpful?

Solution

There are quite a few options, including at least the following:

  1. Expose the classes that you need via COM which can be readily consumed by Delphi.
  2. Create a mixed mode C++/CLI wrapper that uses the C# DLL as a reference. That mixed mode DLL can export native functions and you can then consume that DLL using Delphi external. That is, you consume the DLL just in the same way as Windows system DLLs are consumed.
  3. Use Robert Giesecke's UnmanagedExports.
  4. Use the CLR's native API to consume the C# DLL directly. This option is probably the least attractive since it's the hardest to get right.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top