chris13work
chris13work

Reputation: 89

Using Perl on Solaris, how do I import a C (.so) library?

Is there 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.

Upvotes: 0

Views: 217

Answers (3)

Try C::DynaLib.

Upvotes: 1

sarnold
sarnold

Reputation: 104080

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.

Upvotes: 1

R.. GitHub STOP HELPING ICE
R.. GitHub STOP HELPING ICE

Reputation: 215517

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.

Upvotes: -1

Related Questions