![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
(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?? |
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 search.cpan.org 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: 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")
In Section
Seekers of Perl Wisdom
|
|