@alfkil
Quote:
Is it possible to use -lauto when building a shared object?
No, you must not link any static link library into a shared object. That doesn't work and will crash.
(Unless all code in the static link library was compiled with -fPIC, but libauto.a isn't.)
A libauto.so wouldn't make much sense since it would always open
all supported libraries, classes, devices, etc., not only the required ones.
Quote:
gcc -shared -Wl,--no-undefined myso.c -o libmyso.so -lauto
You have to add -fPIC (for compiling if you do it seperately) and remove -lauto.
Quote:
As you will see, the linker gives errors like "undefined reference to IDOS" etc.
IDOS isn't opend by libauto anyway but by the C library startup code (currently IExec, IDOS, IUtility, SysBase, DOSBase and UtilityBase).
Quote:
I have tried without -Wl,--no-undefined, and it does seem to work this way. Only problem is, I need to keep this flag on for other reasons! Help!?
For what do you need --no-undefined? Using it in a shared object doesn't make sense to me.
If you have to keep using --no-undefined I guess the only way is to open IDOS, but using another variable name, yourself in a constructor function in your shared object and close it again in a destructor function.