Call C# dll from Delphi

You may have more luck skipping the COM part by using my project template for unmanaged exports

class MyDllClass
    static int MyDllMethod(int i)
        MessageBox.Show("The number is " + i.ToString());
        return i + 2;

In Delphi, you’d import it like so:

function MyDllMethod(i : Integer) : Integer; stdcall; extern 'YourAssembly.dll';

I had to vote your question down, though. For not even caring as much as to provide code that would compile. (your C# method doesn’t return a value, yet it expects as int)

Leave a Comment