Penguin
Diff: SharedLibrary
EditPageHistoryDiffInfoLikePages

Differences between version 3 and predecessor to the previous major change of SharedLibrary.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 3 Last edited on Tuesday, June 1, 2004 9:31:52 am by DanielLawson Revert
Older page: version 2 Last edited on Monday, May 31, 2004 9:30:48 pm by SamJansen Revert
@@ -41,4 +41,31 @@
  
 So long as you don't change the call signature of one of the functions (or what they do, in a way that would break programs), you can just bump the minor version of the library and programs using the SharedLibrary will just work. If you do change call signatures on existing functions or change their semantics, bump the version, try to recompile the programs, and check that they work correctly once they pass. Another way to make it usable is to put it in a directory refered to in your __LD_LIBRARY_PATH__ environment variable. 
  
 For more information, see Ulrich Drepper's [How to write shared libraries | http://people.redhat.com/drepper/dsohowto.pdf]. 
+  
+!! Creating a SharedLibrary using libtool(1)  
+  
+libtool(1) is a package designed to assist with the creation of shared libraries. See the libtool(1) node for more information (eventually) about this program.  
+  
+If you have a .c file you wish to include in a library with libtool, you need to make a .lo file for it:  
+  
+ libtool --mode=compile gcc -c trace.c -o libtrace.lo  
+  
+Once you have a .lo file, you need to make a .la file  
+  
+ LDLIBS=-lpcap -lz  
+ libtool --mode=link gcc -o libtrace.la libtrace.lo -rpath /usr/local/wand/lib \  
+ $(LDLIBS) \  
+ -version-info 1:2:0  
+  
+One nice feature of libtool is that you can specify other shared libraries that this one will depend upon (in the LDLIBS env var above), and this will be included in the linker script - any package linking against libtrace in the above example will automatically link against libpcap and libz as well  
+  
+To install the libraries, you use libtool once more:  
+  
+ libtool --mode=install install -c libtrace.la /usr/local/wand/lib/libtrace.la  
+ libtool --finish /usr/local/wand/lib/  
+  
+As a final step, I make sure to install my header files somewhere useful!  
+ cp ../include/libtrace.h /usr/local/wand/include/libtrace.h  
+  
+There are excellent docs on using libtool supplied with the program.