[Mono-dev] ARM PInvoke issue when using long

Jonathan Pryor jonpryor at vt.edu
Wed Nov 8 05:47:48 EST 2006


On Wed, 2006-11-08 at 11:29 +0100, Robert Jordan wrote:
> > It seems there is an issue with mono PInvoke on a 32 bit ARM platform.
> > If I have a native method declared as:
> > 
> > [DllImport("MyDll")]
> > static extern long Test1(int n1, long n2, long n3, int n4, long n5);
> 
> C "long" is usually 32 bit on 32 bit platforms, while C# "long"
> is 64 bit. The correct p/invoke declaration is:
> 
> [DllImport("MyDll")]
> static extern int Test1(int n1, int n2, int n3, int n4, int n5);

His declaration is correct.  His C code is using `long long', not
`long', and `long long' is a 64 bit integer:

> > extern "C"
> > long long Test1(int n1, long long n2, long long n3, int n4, long long n5)

Consequently, his original P/Invoke declaration looks correct.

I'm still not sure why it doesn't work for him.

 - Jon





More information about the Mono-devel-list mailing list