Hi Gaby,
Is the FFI supposed to work with GCL? I've had mostly
success (except for the limitations on the data types that
can be passed back and forth) in using it with SBCL to
rework the webserver using C sockets but when I tried it
with a GCL build it didn't work.
For example if I have this C file (testgcl.c):
#include <stdio.h>
int HelloWorld(int choose)
{
printf("hello spad\n");
return choose;
}
which I compile with
gcc -O2 -fpic -c testgcl.c
and
gcc -shared -o testgcl.so testgcl.o
and then this spad file (testgcl.spad):
)abbrev package TESTGCL TestGCL
TestGCL(): Public == Private where
Public == Type with
helloWorld: SingleInteger -> SingleInteger
Private == add
loadNativeModule("./testgcl.so")$System
import HelloWorld: SingleInteger -> SingleInteger from Foreign C
helloWorld(n) == HelloWorld(n)
which compiles OK then I get this back from OpenAxiom:
(1) -> helloWorld(0)$TestGCL
HelloWorld is undefined
>> System error:
Cannot get relocated section contents
With the SBCL build it works except I get a warning the
first time I call the helloWorld function:
(1) -> helloWorld(0)$TestGCL
STYLE-WARNING: Undefined alien: "HelloWorld"
hello spad
(1) 0
Type:
SingleInteger
(2) -> helloWorld(0)$TestGCL
hello spad
(2) 0
Type:
SingleInteger
Arthur
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
open-axiom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open-axiom-devel