Re: Extending XML::LibXML through XS

Petr Pajas <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Organization UFAL MFF UK
Message-ID <[email protected]>
Dne Saturday 29 November 2008 22:27:07 Emmanuel Rodriguez napsal(a):
> Hi,
>
> I have a perl application that needs to walk an XML::LibXML DOM tree
> in order to display it in a Gtk2::TextView. I have to recursively go
> through each node as I need to highlight them with the proper style.
> The multitude of XS calls triggered by this are hurting the
> application's performance.
>
> I rewrote this part in C and I need to link it to perl through XS. The
> Gtk2 bindings make this possible by installing the typemap and .h
> files that they use. I can easily pass a Gtk2::Widget from perl to XS,
> so this part is covered.
>
> Right now I'm struggling with the exchange of LibXML types between
> perl and XS. I could only find the typemap file used by XML::LibXML in
> the source distribution, so I had to copy it. Now my module builds but
> it can't be loaded, perl gives me the following error message:
>
> symbol lookup error: Xacobeo/XS/XS.so: undefined symbol: PmmSvNode
>
> How can I manage to pass the XML::LibXML data types from perl to XS?
> Are the typemap and header files of XML::LibXML shareable with other
> modules?

Hi Emmanuel, 

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);

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.

Best,

-- Petr
_______________________________________________
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.