Home: Perl Programming Help: Intermediate:
I want to link a C (.so) file with perl using XS



CBRajesh
New User

Aug 30, 2013, 11:07 AM


Views: 2655
I want to link a C (.so) file with perl using XS

Hi all ,

I am trying to call a C function within a .so file in perl .
I was able to generate the .xs , and also add code , I wrote a is_even(int) call in perl

#!/usr/bin/perl
use ExtUtils::testlib;
use test;
test::is_even($ARGV[0]);

No is_even() is in .xs file which on true calls a inline printf("Even") condition and false calls another main_print("Odd") . This main_print("Odd") is defined in a shared object (.so) file generated from a C file .

I am getting a
/usr/bin/perl: symbol lookup error: /home/abcd/perlPrac/test/blib/arch/auto/test/test.so: undefined symbol: main_print

Kindly need your suggestion as to make this work .. thanks in advance !