Re: [xml] [PATCH] DSO/Module Support

On Tue, Dec 21, 2004 at 04:03:35AM -0500, Daniel Veillard wrote:
On Mon, Dec 20, 2004 at 05:37:14PM -0500, Joel Reed wrote:
The following patch implements a basic API for dynamically loading
shared objects (.so/.dll files).

The API is as follows:

XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename);       
XMLPUBFUN void* XMLCALL xmlModuleSymbol (xmlModulePtr module, const char* name);
XMLPUBFUN int XMLCALL xmlModuleClose(xmlModulePtr module);                
XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module);

  Okay I read the patch, this looks clean I have just a few comments:
     1/ why different close() and free() operations ? Can you call
        free() without calling close() first ? I don't see a way to
      "reopen" a module.

you can see how ModuleFree is used in libxslt patch. basically used to
load the DSO into memory & leave it there, but free libxml related module
buffers. we could get rid of struct if you like, i put it
there to make debugging easier. i put xmlModuleClose in there for the
load a module/DSO, use it, and close it use case.

     2/ XML_FROM_MODULE must be moved at the end of the enum list to
        not break ABI compatibility.
     3/ xmllint --version should be extended to display whether module
        support was compiled in.

ok, will do.

     4/ I don't see support for "sharing" loaded modules, I wonder how often
        multiple pieces of code will rely on the same extensions and how
      this is best handled. Maybe the system interface take care of that
      maybe not, maybe it would be usefule at the libxml2 layer, maybe not.
      That can probably be added later if deemed needed.

sounds reasonable.


thanks for reviewing the patch Daniel.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]