release 0.1.1 (May 02 2005)
libshare is a dirty patch to build shareable LDG against mintlib... well, this is the aim of libshare, but the current version of libshare doesn't allow to build shareable libraries... but it allows to build non-shareable libraries (LDG) that use libc functions.
Mintlib is not designed to build shareable library _with_ shared data. So, if you want to build a shareable library (LDG/SLB), you shall not build your library against mintlib. In other words, the very usefull C standard functions (fopen, malloc, fread...) shall not be used !
This patch replace some of the mintlib function by others, in order to have a more shareable libc...
Please keep in mind that this is a "dirty patch". A lot of stuff are missing in order to be able to build a shareable LDG/SLB against mintlib/libshare.
In my opinion, the only clean way to have real shareable library... is to implement the dynamic library mechanism in freemint. Volunters are welcome :)
The libshare library is an independant library. You don't have to modify your mintlib library.
The package contains libshare.a (the library) and libshare.h (the header file that defines libshare_init() and libshare_exit()).
The functions in this library will replace the one from mintlib thanks to the use of weak_alias in mintlib.
The archive contains libshare sources, binaries, and a small example.
libshare-0.1.0.tgz (139.392 bytes)
To install libshare, just type "make install", or do it by hand (copy libshare.a to your /lib directory, and copy libshare.h to your /include directory)
In the makefile, just add "-lshare" in the gcc command line that build
your LDG. For example:
gcc -o my_lib.ldg $(OBJ) -lshare -lldg -lgem
Do _not_ add the "-lshare" word to build applications. This must be reserved for LDG.
The libshare_init() function shall be called right after the LDG is loaded. So, your LDG shall provide a "init" function (the name doesn't matter -- call it "lib_init" if you prefer). This "init" function shall call libshare_init(). You should include <libshare.h> to get its prototype. Then, application that load this LDG shall first call this "init" function.
The libshare_exit() function shall be called right before the LDG is unloaded. So your LDG shall provide a "close function" that call libshare_exit().
See the test/ directory included in the archive to get an example.
At the moment, you cannot build shareable LDG with this version of libshare... a lot of stuff are missing.