Creating executable shared libraries ?

Gerry trick@icculus.org
Sat Aug 14 02:04:00 GMT 2004


Hello. I'm trying to create a shared library that can also be executed as a 
normal executable in Linux (like libc.so), but I've run into some problems. 
For it to be linkable as a shared library I have to use the -shared option, 
but that disables any entry point information. Either leaving main in (as a 
weak symbol) or using the -e option (which seems to be undocumented ?) 
results in segfaults and such because no libraries seem to be resolved, not 
even libc. I've tried linking the required libraries statically, but that 
doesn't seem to work either. Googling didn't turn up anything useful.

Does anyone know how to do this properly ?

(Please cc any answers to me, as I'm not subscribed to this list.)

Thanks,
- Gerry



More information about the Gcc-help mailing list