[Mono-dev] ARM PInvoke issue when using long

Bill Seurer seurer at us.ibm.com
Wed Nov 8 10:12:56 EST 2006


I am not familiar with ARM but I had to change a setting in order to get
the JIT to use the right registers for long longs on power on AIX.  Some
architectures require that things too long to fit in a register be passed
starting in only even (or was it odd?) registers.  If you insert another
int between the two long longs (n2 and n3) in your test and it works that
is probably the problem.

I looked and it was the define ALIGN_DOUBLES in mini-ppc.c.  There's no
such thing in mini-arm.c but maybe the same sort of thing is happening or
not happening as the case may be.
--
Bill Seurer     IBM System i5 internal compiler development   Rochester, MN
Business: seurer at us.ibm.com                         Home: Bill at seurer.net
http://w3.rchland.ibm.com/~seurer/                  http://www.seurer.net


mono-devel-list-bounces at lists.ximian.com wrote on 11/07/2006 06:32:14 PM:

> Hi,
>
> 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);
>
> extern "C"
> long long Test1(int n1, long long n2, long long n3, int n4, long long n5)
> {
>     printf("Test1 %d,%lld,%lld,%d,%lld\n",
>             n1,
>             n2,
>             n3,
>             n4,
>             n5);
>
>     return 12345;
> }
> and I invoke with the following parameters:
>
> Test1(1, 2, 3, 4, 5);
>
> the result is:
>
> Test1 1,2,12884901888,0,21474836484
>
> 12884901888 = 0x300000000
> 21474836484 = 0x500000004
>
> Dan
>  Get your email and see which of your friends are online - Right on the
> new Yahoo.com _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list