Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: "symbol lookup error" message help

by Special_K (Monk)
on Jan 28, 2023 at 17:43 UTC ( [id://11149986]=note: print w/replies, xml ) Need Help??


in reply to Re: "symbol lookup error" message help
in thread "symbol lookup error" message help

> XS modules need to be compiled when installed, using the same compiler as the Perl they are being installed to.

What exactly is being compiled into what in this context, and by what? Is it C/C++ -> assembly? Perl -> something else? Is xsubpp is the compiler in the context of the quoted message? I'm just trying to understand why the same version of perl is required to run modules that use XS as was used to install them.

Replies are listed 'Best First'.
Re^3: "symbol lookup error" message help
by choroba (Cardinal) on Jan 28, 2023 at 18:11 UTC
    The source code in XS is being compiled into the machine code. See perlxs for details, but it's rather advanced, so maybe start with Wikipedia that has a nice basic introduction.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^3: "symbol lookup error" message help
by hv (Prior) on Jan 28, 2023 at 23:49 UTC

    You could roughly define XS as a macro language - it is only a little bit more than pure C with a bunch of predefined macros. It is preprocessed by xsubpp into C, then compiled with the appropriate C compiler into an object file (i.e. machine code).

    It needs the same version of perl mainly because it deals with a bunch of perl's internal data structures - when compiled, that bakes in knowledge of the size of those structures, and the offset of various elements within them. It also bakes in knowledge of the signature of the various perl internal functions it may call, along with compiler-specific calling conventions.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149986]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-03-28 21:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found