Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

(tye)Re: Load and unload modules ala dlopen();

by tye (Sage)
on Oct 07, 2000 at 08:31 UTC ( #35726=note: print w/replies, xml ) Need Help??

in reply to Load and unload modules ala dlopen();

I'm pretty sure that the "module" here is not a Perl module, due to the reference to dlopen(), which is the C interface to shared libraries.

So what you need is the Perl module C::DynaLib. You can also try the FFI module which supports call-backs. They both allow you to attach to a shared library (or *.DLL under Windows) and call routines in it.

You can also try the Inline module which lets you, at run time, write C code to interface to the shared library, compile that C code into a shared library module that Perl can load, and then use that shared library to access the library you are interested in -- all without leaving the currently running script. Subsequent requests to use that C code only go through the compilation step if you have changed the C code. A pretty neat module but probably not as good for what you seem to want as the first two I mentioned.

All of these are available from CPAN. Go to and search for any of these modules to browse the read-me files or documentation. Then download the latest version, probably as a *.tar.gz file. I hope you already have gunzip or GNU tar [and I assume that you already have tar since you mentioned dlopen()]. That way you can unpack the archive and do the standard:

perl Makefile.PL make test make install
to build, test, and install the Perl module.

Once the module is installed, you can type "perldoc C::DynaLib" (for example) to read the documentation that came with the module.

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

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2023-12-11 13:13 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.