PDA

View Full Version : Creating libraries?



Mathiasdm
May 6th, 2007, 08:12 PM
I'm trying to find out more about writing libraries for usage by programs (both statical and dynamical ones). I've been looking around on google for a while, but it's a mess! I can't seem to find a clear explanation on writing libraries (I'm working in C and C++, by the way).

Could anyone point me to a nice link?

Wybiral
May 6th, 2007, 08:28 PM
Look for the command "ar"
It's actually pretty simple (just compile some object files and pass them to ar)

For loading dynamic libraries, the "dlfcn.h" (link to it with "-ldl")
For compiling dynamic libraries (shared objects) use the "-fPIC" and "-shared" flags when generating the object files.

http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html