Re: Extending XML::LibXML through XS

"Emmanuel Rodriguez" <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
On Sat, Nov 29, 2008 at 11:30 PM, Petr Pajas <[email protected]> wrote:
>
> Hi Emmanuel,
Hi Petr,

Thanks for the pointers!

>
> PmmSvNode(node) is a macro defined in XML::LibXML's libxml-perl-mm.h that
> expands to a function call PmmSvNodeExt(node,1) whose prototype is
>
> xmlNodePtr PmmSvNodeExt(SV* node, int copy);

I tried this but then I get the following error at runtime:
symbol lookup error: Xacobeo/XS/XS.so: undefined symbol: PmmSvNodeExt

I managed to get around this error by linking Xacobeo/XS/XS.so with
/usr/lib/perl5/auto/XML/LibXML/LibXML.so. I'm not too crazy about
linking to LibXML.so as I will need to detect where the .so is.

>
> Try adding just this prototype and either defining the macro or rewriting the
> typemap to use the direct function call. Hopefully the dynamical linker will
> be able to locate the symbol in XML/LibXML.so loaded with XML::LibXML. If
> not, you'll have to copy-paste the function from perl-libxml-mm.c.
>
I tried to copy  perl-libxml-mm.c and perl-libxml-sax.c (it's needed
by perl-libxml-mm.c) but I still have problem at runtime:
undefined symbol: PROXY_NODE_REGISTRY_MUTEX

I've checked and this mutex is declared in LibXML.c. I tried to link
again with LibXML/LibXML.so but the error persists. The only way I
found out to remove the error is to declare  PROXY_NODE_REGISTRY_MUTEX
in xs file. I'm not sure that this is a great idea as the mutex seems
to be used for thread synchronization and this will create two
different mutexes.

I think that I have no choice but to use the first alternative: to
declare the prototypes of PmmSvNode and PmmSvNodeExt and to link with
XML/LibXML/LibXML.so
-- 
Emmanuel Rodriguez
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.