<quote who="Chris Barnes"> > could anyone inform me on how to compile a shared object (.so) file. > I am trying to use a program i have compiled, but it comes with only 2 modem > drivers. > I have found the source for my modem "serial_cb.c", I also found another > object file "serial_cb.o" but the program I want to run tries to get drivers > from .so files. > I'm a new to this area so if anyone has any ideas that would be most > appreciated. >
.so files are shared library files. You place an object (.o) file into a shared library with a command like: gcc -shared input.o -o sharedlib.so Typically, the object file needs to have been compiled with the -fPIC flag for the .so file to be any use. -fPIC instructs the compiler to produce Position Independent Code, which allows it to be relocated within the program's address space when it is used at run time. For a command which is portable across more systems, you can learn about libtool, which knows how to produce shared libraries on many systems and which automates the production of the correct compiler commands on each system. Whether or not the shared library produced will work with the program you have in mind is another thing: If the serial_cb.c file isn't written to be a module for the program you are using, then you will almost certainly find that it won't work. Programs which use shared libraries as loadable-modules look inside the shared library for specific functions and make calls to them. If the shared library isn't designed as a module for the program, then it probably has not got the function calls implemented. Did I miss anything? Cheers, J. -- Jan Schmidt [EMAIL PROTECTED] "Stoke me a clipper, I'll be back for Christmas" -- Arnold 'Ace' Rimmer, Red Dwarf
msg18069/pgp00000.pgp
Description: PGP signature
