Hi all,
I thought I understood how the ffi worked, until I tried the following. What
am
I doing wrong?
$ cd /tmp
$ echo "int give_me_ten() { return 10; }" > foo.c
$ gcc -fPIC -c foo.c
$ gcc -shared -o libfoo.so foo.o
$ factor -run=listener
( scratchpad ) USING: alien alien.libraries alien.syntax ;
( scratchpad ) "foo" "/tmp/libfoo.so" "cdecl" add-library
( scratchpad ) "foo" load-library
--- Data stack:
DLL" libfoo.so"
( scratchpad ) "int" "foo" "give_me_ten" { } alien-invoke
alien-invoke-error instance
library "foo"
symbol "give_me_ten"
Type :help for debugging help.
--- Data stack:
DLL" libfoo.so"
( scratchpad ) LIBRARY: foo
--- Data stack:
DLL" libfoo.so"
( scratchpad ) FUNCTION: int give_me_ten ( ) ;
--- Data stack:
DLL" libfoo.so"
( scratchpad ) { give_me_ten } compile
--- Data stack:
DLL" libfoo.so"
( scratchpad ) give_me_ten
The image refers to a library or symbol that was not found at load time
Type :help for debugging help.
--- Data stack:
DLL" libfoo.so"
Cheers,
Jeremy
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk