How to associate a static C object object with Perl?

I have a function written in C (let's say in the HelloWorld.c file). I want to compile this and create a staic object file HelloWorld.a

Finally, I need to call this from the Perl program (HelloWorld.pl).

+5
source share
3 answers

For a call from perl to C, a common library, rather than a static library, from its c code is usually compiled, and then it is loaded into the perl interpreter using the XSLoaderor module DynaLoader.

C perl-, . , XSUB s, perl-, perl C- C. XSUB , perl XS, perlxs perlxstut.

-, , XS, SWIG. C , NCI. Perl . P5NCI - , ctypes, , Google Summer of Code - .

, , , , - Inline::C Inline. perl . Inline:: C XS .

+9

@rafl, .

, Perl . XS-. , , .

+3

perlxstut:

, , XSUB. . , XSUB Perl, . Perl 4.

- . XSUB , , , , , .

, , , "make" , "make perl".

If you created such a statically linked executable file of your choice, then instead of saying " make test", you should say " make test_static". On systems that cannot create dynamically loaded libraries at all, just say " make test".

+2
source

All Articles