Calling a delphi DLL method from C# Code

前端 未结 2 1619
忘掉有多难
忘掉有多难 2021-01-13 07:51

I am trying to call a Delphi function from C# ASP.NET code. The function\'s declaration looks like this:

function SomeFunction(const someString, SomeOtherStr         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-13 08:02

    Try

    [DLLImport(MyDLL.dll, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
    public static extern IntPtr SomeFunction(string someString, string SomeOtherString);
    

    and use Marshal.GetObjectForNativeVariant with the return value to get a .NET object.

提交回复
热议问题