Levente said:
The error message is correct, you should specify the return type as long. There's no int type in FFI, probably because it's ambiguous (even in C) and unnecessary.
Thank you Levente. This was enough to get me farther and have the method compile. If I were planning to do anything serious with this I would certainly use trunk and take advantage of your fix, thanks for that also.
I've fiddled with it a bit and the best result I have gotten so far is if I implement my AnFFITest class as a subclass of ExternalObject and put my method on the class side:
testRand "simplest test I could think of" <cdecl: long 'rand' ()> ^self externalCallFailed
This fails with 'unable to find function address'. Perhaps rand isn't a function or I need to do something more to indicate that the function is a libc function, or I've made some other mistake.
Separately David has suggested that for my self-built VM I specify -m32 but if I do that with cmake/configure -CFLAGS=-m32 configure fails with 'no suitable type found' with the top of the stack 'vm/config.cmake:71 (TEST_BIG_ENDIAN). In all likelihood I'm not doing this right and I will continue to look around. However even with the normal build cmake gives a stern warning that we are using an accidental and deprecated feature (The source directory .../unix/npsqueak does not contain a CMakeLists.txt file). I'm using cmake 2.8.4 and I wonder if cmake has moved beyond our currently cmake configuration.
I'll continue to mess with it and I welcome any suggestions anyone has.
Ken
On Wed, May 25, 2011 at 09:00:45AM -0700, Ken Causey wrote:
Levente said:
The error message is correct, you should specify the return type as long. There's no int type in FFI, probably because it's ambiguous (even in C) and unnecessary.
Thank you Levente. This was enough to get me farther and have the method compile. If I were planning to do anything serious with this I would certainly use trunk and take advantage of your fix, thanks for that also.
I've fiddled with it a bit and the best result I have gotten so far is if I implement my AnFFITest class as a subclass of ExternalObject and put my method on the class side:
testRand "simplest test I could think of" <cdecl: long 'rand' ()> ^self externalCallFailed
This fails with 'unable to find function address'. Perhaps rand isn't a function or I need to do something more to indicate that the function is a libc function, or I've made some other mistake.
Separately David has suggested that for my self-built VM I specify -m32 but if I do that with cmake/configure -CFLAGS=-m32 configure fails with 'no suitable type found' with the top of the stack 'vm/config.cmake:71 (TEST_BIG_ENDIAN). In all likelihood I'm not doing this right and I will continue to look around. However even with the normal build cmake gives a stern warning that we are using an accidental and deprecated feature (The source directory .../unix/npsqueak does not contain a CMakeLists.txt file). I'm using cmake 2.8.4 and I wonder if cmake has moved beyond our currently cmake configuration.
I think you can ignore the stern warning regarding npsqueak. I see that all the time, and since I'm not building npsqueak anyway, I ignore the fact that no CMake configuration has been written for it.
I recently switched PCs and for some reason have not gotten the 32 bit libraries (especially sound) installed properly, so I have not been building 32-bit VMs lately (64-bit works fine for everything I do anyway). But if you have enough of the 32-bit libraries installed, building with -m32 *should* work. Sorry I'm being a bit unhelpful here as a result.
Dave
vm-dev@lists.squeakfoundation.org