[Pharo-project] NativeBoost linux 8 byte structures
eliot.miranda at gmail.com
Mon Jan 28 17:01:56 EST 2013
On Sun, Jan 27, 2013 at 2:26 PM, Ciprian Teodorov <
ciprian.teodorov at gmail.com> wrote:
> Hi Guys,
> Today I wanted to test my TalkFFI project on linux, and I run into some NB
> It seems that the VM crashes when trying to invoke a function returning a
> 8 byte structure.
> I have tried with 4 bytes structure and I get some bogus data but no crash
> with 12 bytes structure it seems to work...
I suspect this is a win32/linux difference that NB doesn't handle yet. On
win32 power-of-two structures <= 8 bytes in length are returned in
registers. On linux they're always returned through memory. Here are the
relevant defs from the ThreadedIA32FFIPlugin
#if defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__)
/* Both Mac OS X x86 and Win32 x86 return structs of a power of two in size
* less than or equal to eight bytes in length in registers. Linux never
# if __linux__
# define WIN32_X86_STRUCT_RETURN 0
# define WIN32_X86_STRUCT_RETURN 1
#define returnStructInRegisters(sz) (WIN32_X86_STRUCT_RETURN && (sz) <= 8
Attached to this mail you will find a simple test case.
> the c file I have compiled with:
> gcc -g -fPIC -Wall -c -m32 strreturn.c
> gcc -shared -g -Wl,-soname,libret.so.1 -o libret.so -m32 strreturn.o -lc
> Dr. Ciprian TEODOROV
> Ingénieur Développement CAO
> tél : 06 08 54 73 48
> mail : ciprian.teodorov at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev