[Mono-dev] ARM PInvoke issue when using long

Robert Jordan robertj at gmx.net
Wed Nov 8 05:55:35 EST 2006


Jonathan Pryor wrote:
> 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:

Oops, I overlooked "long long".

Robert




More information about the Mono-devel-list mailing list