Multiple modules in a .so?

Dan Connolly (connolly@ulua.hal.com)
02 Aug 1994 14:38:44 GMT

I'm integrating parts of libWWW into my python interpreter. I've got
SGMLmodule.so, HTMIFGenmodule.so, and a handful of others working.

What bothers me about this is that these dynamic libraries share several
object files:

SGML_OBJS = SGML_py.o HTStructured_py.o HTStream_py.o HTFormat_py.o
MIF_OBJS = HTMIFGen_py.o HTStructured_py.o HTStream_py.o HTFormat_py.o

I'd like to create one WWWmodules.so, and support several python modules
in that one shared library.

The best hack I can think of so far is:

* link all the code in one .so
* write one big (static) init routine that calls initmodule() for each
module in the .so
* write little (external) init routines for each modules
that just call the big
init routine
* create symlinks from SGMLmodule.so, HTMIFGenmodule.so, etc. to
the big .so

That way, no matter which module I import first, it'll
* find the .so
* call the big init routine
* initmodule() all the modules in the library

Anybody got any better ideas?

-- 
Daniel W. Connolly        "We believe in the interconnectedness of all things"
Software Engineer, Hal Software Systems, OLIAS project   (512) 834-9962 x5010
<connolly@hal.com>                   http://www.hal.com/%7Econnolly/index.html