[Mono-dev] ARM PInvoke issue when using long

Robert Jordan robertj at gmx.net
Wed Nov 8 05:29:47 EST 2006


D M 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);

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

Robert




More information about the Mono-devel-list mailing list