Re: Trouble trying to use Shared Libraries with AIX 3.2.5
Posted in 1997
I think this is a common thing on c compilers (I work on HP-UNIX platform). I think that the concept of a library (whether shared or static) is that others are to use these 'common' functions, but these library functions shouldn't be calling other functions outside of its library (if that could happen, then if someone wanted to use one of those functions, they couldn't just link in that library, since they would get "unresolved symbols" of the function that the library functions call, and then they would have to hunt down those libraries, maybe guess at which one they're in; it could be a real mess). One way around this is to put all of the functions in one library. For example, if your library is called lib1.sl, make a lib2.sl with the object files that contain the functions called from within lib1.sl, and link in lib1.sl. Then when you make your executable, you just have to link in lib2.sl. This is what EDA does. When I use EDA in my program, I link in a shared library. Running Purify against my program, showed that the library in turn links in at least 8 other libraries. If for some reason you absolutely do not want those external functions in a library, try changing the order of the files (object and library) when linking. Put the object files/library that call the function first, then the files that have the function code afterwards. It seems that if the linker comes across the function code first, it ignores it, since it thinks it doesn't need it; but if it comes across a call to a function, then it knows to look out for the code of that function, and will find it if it hasn't already read the file that contains the function. Paul