I'm having some problems loading foreign code into SBCL 0.8.5
on Darwin (OS X 10.3)
Essentially I'm trying to load the library libcpgplot.a,
which I've broken down into an object file cpgplot.o
ar -x libcpgplot.a
ld -r *.o -o cpgplot.o
I do it this way because simply loading a .a file did not work
under Linux, but this variant did work. I also tried other
variants (see below)
I load the library with:
;; prevent undefined dyld_stub_binding_helper
;; prevent undefined _G77_getenv_0
;; other stuff that g77 seems to want
the above mess came from a long round of experimention to
ensure all the symbols resolved during the load-alien call.
Now all the symbols are resolved, but when I try
to do sb-alien:define-alien-routine I get the error (eg)
'unknown foreign symbol: "_cpgarro"'
The error occurs in (SB-SYS:FOREIGN-SYMBOL-ADDRESS-AS-INTEGER "_cpgarro")
and cpgarro is the very first C function I use in def-alien-routine.
-- cpgarro is defined in libcpgplot.a
I could get this library to work under Linux and Solaris, but with a
different set of supporting libraries.
You will observe that I am loading libcpgplot.a twice (in
desperation): once as the cpgplot.o and once as libcpgplot.a, but I
can remove libcpgplot.a and it behaves the same, or I can replace
cpgplot.o with libcpgplot.a without changing the outcome.
Natually, as a test I tried to load a simple .o file with one
test function and no libraries, and that linked in just fine,
and I was able to call the test function.
Does anyone know if there are some tricks or peculiarities
with Darwin object file loading? Am I just doing something obviously
Many thanks for any help.
Do you Yahoo!?
Free Pop-Up Blocker - Get it now