|
[Sbcl-help] loading foreign object files under Darwin
From: John Klein <jk271828@ya...> - 2003-11-23 08:09
|
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
using:
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:
(sb-alien:load-alien '("cpgplot.o")
:libraries '("/data/Software/lib/libpgplot.a"
"/data/Software/lib/libcpgplot.a"
"-lc" "-lz"
"/sw/lib/libpng.a" "/usr/X11R6/lib/libX11.a"
;; prevent undefined dyld_stub_binding_helper
"/usr/lib/bundle1.o"
;; prevent undefined _G77_getenv_0
"/sw/lib/libg2c.a"
;; other stuff that g77 seems to want
"/usr/lib/libcc_kext.a" "/sw/lib/libf2c.a"))
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
dumb?
Many thanks for any help.
__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/
|
| Thread | Author | Date | |
|---|---|---|---|
| [Sbcl-help] loading foreign object files under Darwin | John Klein <jk271828@ya...> |
|
|