dynamic linking on Mac [message #76590] |
Fri, 10 June 2011 16:01 |
brodzik@nsidc.org
Messages: 7 Registered: July 2005
|
Junior Member |
|
|
Hi, all,
Has anyone running IDL on a Mac successfully linked to a shared C
library?
I've got some code that lets me call the routines in a C library from
IDL. It's name is call_grids.c and everything works fine on my linux
system. I'm trying to port the whole thing from Suse linux to a Mac,
and I'm having trouble on the linker step for call_grids.so. I've
already compiled and tested the original C library (which is
libmapx.a), it has some command-line programs that call it, and they
are working fine.
But for call_grids.c, in my Linux options, my makefile sets CFLAGS to -
fPIC and C_LD_FLAGS to -shared, but I found out pretty quickly that
Darwin's ld doesn't support "-shared". I found one helpful site on-
line that suggested that the Darwin equivalent of '-shared' is '-
bundle -flat_namespace -undefined suppress', but that returns this
problem:
ld -bundle -flat_namespace -undefined suppress -o call_grids.so
call_grids.o -L/Users/mj/lib -lmapx -lm
ld: symbol dyld_stub_binding_helper not defined (usually in crt1.o/
dylib1.o/bundle1.o) for inferred architecture x86_64
make[1]: *** [call_grids.so] Error 1
Then I started researching these ld switches and found several
alternatives to -bundle, including -dynamic, -dylib, -dylinker. My
trouble is that I'm not sure what it is I should be *trying* build,
here. Going back to the suse ld man page, it just says -shared
"builds a shared library". Well, I guess I knew that. What I don't
know is what that's supposed to look like on a Mac.
Can anyone offer me some tips on what I should be trying to create?
Thanks,
Mary Jo
|
|
|