[DUG] Delphi DLL to C#

Alan Rose Alan at seabed.co.nz
Tue Nov 28 08:51:34 NZDT 2006


Thanks Matt, that was the answer. 

> -----Original Message-----
> From: delphi-bounces at ns3.123.co.nz 
> [mailto:delphi-bounces at ns3.123.co.nz] On Behalf Of Matthew Comb
> Sent: Monday, 27 November 2006 6:11 p.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Delphi DLL to C#
> 
> 
> 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
> >
> 
> 
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
> 



More information about the Delphi mailing list