The applications don't need to be the same; just the communication across the network and (if applicable) the format of a transferable file.
I generally design as much as possible in portable code and leave link points for non-portable interfaces such as threads, GUIs, etc. I try to have all non-portable code isolated in its own libraries so that they can be switched out if necessary at link or run time.
The POSIX equivalent to DLL is shared library, ending with .so or .so.0.1, etc. They are essentially a linked object with no execution entry point and relocatable code. You don't need anything special to create them except for the '-fPIC' gcc option (for relocatable code which can be inserted anywhere into a program at run time), the '-shared' ld option, and optionally the '-soname [name + .so + version]' ld option. A soname is used to denote a compatibility version. For example, if all 0.1 versions of your library use the same API you might have libyourlib.so.0.1 as the soname for libyourlib.so.0.1.0, libyourlib.so.0.1.1, etc. That way if a program hard-links to libyourlib.so.0.1.0 it will use libyourlib.so.0.1.1, etc. as they are upgraded but won't use libyourlib.so.0.2.x.
To hard link to a shared library just use '-lyourlib' for libyourlib.so at link time. To link at run time (such as a plug-in) check out dlopen.
ta0kira
Last edited by ta0kira; 05-17-2007 at 03:46 PM.
|