[DUG] Delphi DLL to C#
Matthew Comb
matt at ferndigital.com
Mon Nov 27 18:11:00 NZDT 2006
Hey Alan,
Does it make a difference if you append STDCALL ?
Matt.
> 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
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
More information about the Delphi
mailing list