Re: [xplc-general] Re: strange behavior in xplc_ptr
Cross-platform lightweight components
Status: Alpha
Brought to you by:
pphaneuf
|
From: Avery P. <ape...@ni...> - 2005-08-18 20:21:02
|
On Wed, Aug 17, 2005 at 03:37:42PM +0000, Sébastien Roret wrote: > Well I see I wasn't enough specific. :) The current module loader in xplc > is dynamic. It finds all ".so" file in a directory and registers the > components in the module. In some cases, we need to link statically all > modules with our main. To do that we must collect all module names, find a > way to get the entire component list and register each component to the > component manager. I guess this kind of feature isn't planned for > tomorrow. :) Ha, this is the behaviour we provide in WvStreams on top of xplc, which Pierre thought was gross :) Essentially, the way to do this is to have a static object in each module with a constructor (running at app startup time). The constructor registers the module with the XPLC module system, almost as if it had been loaded by the dynamic loader. Other than global constructors, there is no way I know to just link files together and have it all automatically work out. Luckily, global constructors are really easy to use :) Beware, however: *.a libraries won't work with this method, because none of the objects in the *.a have symbols that you directly link to from other parts of the program. You have to link in the *.o files directly (without first aggregating them into a *.a) or else use something nasty like the WvStreams "wvlinkerhack.h" Have fun, Avery |