in reply to Relocation error with an embedded perl interpreter

The source of your C function should #include the correct libxml headers and be linked to libXML.

After Compline,
Zaxo

  • Comment on Re: Relocation error with an embedded perl interpreter

Replies are listed 'Best First'.
Re: Re: Relocation error with an embedded perl interpreter
by Anonymous Monk on May 11, 2004 at 13:45 UTC
    My app is linked against -lxml2. The trouble is the PmmNodeToSv is provided by the perl library, not the c library. i.e. PmmNodeToSv is in: /usr/lib/perl5/vendor_perl/5.8.3/i686-linux/auto/XML/LibXML/LibXML.so I could link against that I guess, but how to find out where that library is on other peoples systems cleanly?
      Well, I would imagine that if Perl can do it, so can you. You have the source; I would start looking at Dynaloader since that seems to be the guts behind everything.

      I admit that I'm not sure how well that would work; you might need to do some dynamic linking tricks to get the address of your function *after* the .so is loaded by Perl.

      --Stevie-O
      $"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc
        I can't find how to get at dl_find_symbol_anywhere() either :(
        My C is being compiled using ExtUtils::Embed ldopts which links it against libperl and DynaLoader.a, which doesn't seem to include the dl_find_symbol_anywhere() symbol. Nor does "require DynaLoader" allow me to call it from Perl.
        I'm stumped :(
        I've now managed to get a CODEREF to the routine I was after like this:
        eval_pv( "use DynaLoader;" \ "use XML::LibXML;" \ "my $pnts_symref = DynaLoader::dl_find_symbol_anywhere('PmmNod +eToSv');" \ "my $coderef = DynaLoader::dl_install_xsub('kousei::PmmNodeToS +v', $pnts_symref);" TRUE );
        Trouble is, now I can't find how to call it from C with the args I need to pass. Calling it from perl is fine via &$coderef(), but the xmlNode I want to pass to it is in C.
        Any clues?