dynamic link libraries and static libraries

dynamic link libraries and static libraries

Post by Matthew Denne » Tue, 13 Jan 1998 04:00:00

ignore my last posting, i found that if i stuck the static library in
as an object file it still didn't work.  must be something work with my




dynamic link libraries and static libraries

Post by Matthew Denne » Tue, 13 Jan 1998 04:00:00

i am porting a program to Linux from OS/2 that loads DLLs on the fly.
the DLLs are defined as having standard functions ('Init()',
'Terminate()' for example) which the executable queries the address of
through a function call.  under OS/2 i have created a static library
contains the standard functions (so that the programmer is not concerned
with so system specific stuff), which then call the programmers code.

under OS/2 this model works fine (compile the programmer code, link the
output object file with a standard static library that defines the
standard functions to produce a DLL).  under UNIX i get a DLL generated
but the standard functions are missing.

am i correct in assuming that 'gcc' will only link library files and
object files provided that at least one function in the library file
is called by an object file?  if this is true how can i get the DLL to
be linked proper as the standard library calls the object file (and not
the other way round)?  if i'm wrong what is wrong with this line in my

   gcc -shared -Wl,-soname,library.so.1 -o library.so.1.0 library.o

i would appreciate an answer if someone has one.  cheers.




1. Problems linking static library on executable and static library

  I'm a newbie in programming on Un*x platforms, so maybe, it could
be caused by my lack of experience.

Ok. I have a static library "libSM.a" depending on two libraries one
of them shared: "libErrP.so" and a static one: "libCB.a"

I'm trying to compile an executable "EInvA" linking with both "libSM.a" and
"libCB.a" and get the following error:

CC  -mt -fast -DNONE_CLASH -o RELEASE/EInvA     RELEASE/inva.o
-lsocket -lnsl -ldl -lCstd -lc -lnsl -lsocket -lclntsh
-L/libs/libSM/STATIC -lSM -L/libs/libCB/STATIC -lCB

Undefined symbol                 first referenced in file

int CB::Connect(char*, char*) /libs/libSM/STATIC/libSM.a (libSM.o)
CB::CB()                      /libs/libSM/STATIC/libSM.a (libSM.o)
CB::~CB()                     /libs/libSM/STATIC/libSM.a (libSM.o)

And "CB" symbols are defined in "libCB.a"

?Could someone tell me what could be happening?

Thanks in advanced,

2. PPP Server failed (shadow)passwd auth. pap secrets works

3. linking static library against another library

4. streams driver problem

5. link static libraries into a shared library

6. change thread data in ps

7. dynamic and static library link

8. ?? about a device for GS (v.10)

9. Q: Linking C++,C and dynamic/static libraries.

10. Linking with different static and dynamic library

11. Using a dynamic library from another dynamic library

12. Compiling static libraries as shared libraries

13. Building shared library which includes static libraries