I created a DLL in VS2013 using File / New Project / Class Library. Then I tried to load it dynamically into Delphi. But Delphiis returns NIL for the GetProcAddress procedure.
My C # and Delphi code looks like below. The GetProcAddress code returns NIL . Please let me know if I missed something.
C # code
using System; namespace TestDLL { public class Class1 { public static string EchoString(string eString) { return eString; } } }
Delphi Code
Type TEchoString = function (eString:string) : integer;stdcall; function TForm1.EchoString(eString:string):integer; begin dllHandle := LoadLibrary('TestDLL.dll') ; if dllHandle <> 0 then begin @EchoString := GetProcAddress(dllHandle, 'EchoString') ; if Assigned (EchoString) then EchoString(eString) //call the function else result := 0; FreeLibrary(dllHandle) ; end else begin ShowMessage('dll not found ') ; end; end;
source share