[DUG] Delphi DLL to C#
Alan Rose
Alan at seabed.co.nz
Mon Nov 27 16:59:46 NZDT 2006
Hi I'm still learning C# with some tests and cant figure out what I'm
doing wrong here
In delphi dll I have declared an export function
function Add2Numbers2(a,b : integer) : Integer export;
begin
ShowMessage(IntTostr(a)); // debug
ShowMessage(IntTostr(b)); // debug
Result := a + b;
end;
In C# I declare function
[DllImport("SMIEngine.dll")]
public static extern int Add2Numbers2(int a, int b);
int myInt;
myInt = Add2Numbers2(22,11);
MessageBox.Show(myInt.ToString());
When I run this in Microsoft VSE input a is zero, b = 11
When I run this in D2006 a = (large uninitialised number) and b = 11
What have I done wrong that input param a is not going into my delphi
dll as 22
More information about the Delphi
mailing list