Using Perl on Solaris, how do I import a C (.so) library?
Is th开发者_运维问答ere any function to import a C library (.so
) file in the Solaris operating system?
In Windows I can use Win32::API
, how about Solaris?
Thank you.
XSLoader looks to be the simple interface.
DynaLoader looks to be the more complex interface.
But your modules have to be tailored to be imported into Perl; the SWIG toolkit may be the best tool to marshal data between native C and native Perl.
Try C::DynaLib
.
If by import you mean just link against it, you can use -l
followed by the base name of the library on the cc
/gcc
/ command line when linking. For example, to link to libfoo.so
, use -lfoo
.
If by import you mean dynamically load at runtime, lookup the dlopen
and dysym
functions.
精彩评论