Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Calling functions from shared object libraries

by nokesja (Initiate)
on Apr 23, 2001 at 04:51 UTC ( [id://74622]=perlquestion: print w/replies, xml ) Need Help??

nokesja has asked for the wisdom of the Perl Monks concerning the following question:

Greetings,
I am trying to find out if there is a way to call a function that lives in a shared object library (.so file) on UNIX/Linux, from a Perl script. I know how to do it on Win32 systems, with Win32::API. Is there a similar module that can do the same on UNIX systems?
Thanks in advance.
  • Comment on Calling functions from shared object libraries

Replies are listed 'Best First'.
Re: Calling functions from shared object libraries
by AgentM (Curate) on Apr 23, 2001 at 06:20 UTC
      Sorry about offending you.
      I actually have read the FAQs (and perldocs) and the USENET groups, many times over. I have looked at Dynalib and XS as well (I probably should have mentioned that in my original posting). The learning curve for XS is HUGE! and Dynalib by itself cannot do the trick, it even says so in it's documentation. I did not know about the C::Dynalib module, and it looks like it might work for me. Also, I did not know about SWIG, that is a great tool and I appreciate you mentioning it to me. My point to this whole question was that I was just wondering if there was a widely used and accepted module out there that had the very simple interface that Win32::API had, but for UNIX based systems, and apparently there isn't.
      I do thank you for your help and will be much more careful about how I phrase my questions.
      Warmest Regards.
Re: Calling functions from shared object libraries
by BMaximus (Chaplain) on Apr 23, 2001 at 06:11 UTC
    Try looking at the DynaLoader. I do believe it does load shared libraries.

    Update: Oh and there is also the XSLoader. look at the man page for that one.

    BMaximus
Re: Calling functions from shared object libraries
by Masem (Monsignor) on Apr 23, 2001 at 06:12 UTC
    Take a look at perlxs; it's not going to be pretty, but that's probably the only way to get the job done.
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
(tye)Re: Calling functions from shared object libraries
by tye (Sage) on Apr 23, 2001 at 18:05 UTC

    There are FFI and C::Dynalib but you might have better luck building an XS module for this or using Inline to build the XS module.

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-19 09:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found