Re: Compiling dynamic library to use with dlopen()
From: Gary R. Hook (nospam_at_nospammers.net)
Date: Tue, 20 May 2003 13:55:21 GMT
> Hemant Shah <firstname.lastname@example.org> wrote in message news:<email@example.com>...
>>ld -G -T512 -H512 -esomeFunction -odynlink3.sl dynlink3.o
Don't use -T512 and -H512. It's unnecessary on current levels of AIX,
and wastes space.
Always, always, _always_ (did I say "always"?) list system libs when
building modules on AIX. Our libraries contain both static and dynamic
archive members, some of which you may need at link time.
You should not use -G without building your main app with -brtl, if
you have symbols that are runtime resolved. In this example, I'm
referring to printf(). Unless of course, you've architected the
module to work both with and without runtime linking.
>>I tried -brtl and -ldl options but still get same error. How do I compile
>>the above code properly.
The dl routines are in libc now; libdl is no longer required.
> The -e option not only does not export the function someFunction, it
> actually prevents it being exported, even if you use the -bexpall
Incorrect. -e only specifies the entry point, which can also (or not)
be an exported symbol.
I would suggest reading up on AIX linking at
-- Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE ________________________________________________________________________