dlsym() fails with an executable shared library
Mayank Kaushik
mayank.utexas@gmail.com
Fri Dec 9 00:58:00 GMT 2011
> Worked fine when I tried it. I built your source code using
>
> gcc -fPIE -pie -o foo.so foo.c -rdynamic
Thanks, it indeed does. I had to leave out -fPIC. I'm curious, why did
that cause a problem?
Last question; is the first method expected to also work on Mac, with
the linker replaced by the appropriate linker for Mac, if I'm using
gcc et al to build? I.e.:
const char my_interp[] __attribute__((section(".interp"))) = "<dyld path>";
(...)
gcc -Wall -fPIC -shared -o library.so test.c -lc -Wl,-e,my_main
In other words, does gcc on Mac support executable shared libraries?
Thanks,
Mayank
More information about the Gcc-help
mailing list