Perl Module using XS

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello "XS  Gurus":
I am trying to develop a perl extension using XS that would execute a DB2's
'.sqc' generated c executable.( equivalent of Oracle's pro*c generated
executable). The 'C' executable executes fine by itself.  I am having a hard
time getting the perl module work.
I added in the '.xs' file the Xsubb for the function that is declared in the
'C' program.
In the Makefile.PL, I added the object files generated from the 'C' program
and also the path where the object file can be fouind.
Still, the make process does not succeed in building the 'C' function into
the Perl module.
Could anyone show pointers as to what i am missing

use 5.008008;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/ for details of how to influence
# the contents of the Makefile that is written.
        NAME              => 'RajanT',
        VERSION_FROM      => 'lib/', # finds $VERSION
        PREREQ_PM         => {}, # e.g., Module::Name => 1.1
        ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
        (ABSTRACT_FROM  => 'lib/', # retrieve abstract from module
        LIBS              => [''], # e.g., '-lm'
        DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
        INC               => '-I. -I/home/db2inst2', # e.g.,
'-I. -I/usr/include/other'
        MYEXTLIB => 'rlib/libmylib$(LIB_EXT)',
                # Un-comment this if you add C files to link with later:
                OBJECT            => '$(example2.o)', # link all the C files
if  (eval {require ExtUtils::Constant; 1}) {
# If you edit these definitions to change the constants used by this module,
# you will need to use the generated and
# files to replace their "fallback" counterparts before distributing your
# changes.
my @names = (qw(TESTVAL));
NAME         => 'RajanT',
NAMES        => \@names,
C_FILE       => '',
XS_FILE      => '',
else {
use File::Copy;
use File::Spec;
foreach my $file ('', '') {
my $fallback = File::Spec->catfile('fallback', $file);
copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";

sub MY::postamble {
$(MYEXTLIB): rlib/Makefile
        cd rlib && $(MAKE) $(PASSTHRU)

Re: Perl Module using XS

[A complimentary Cc of this posting was sent to
Rajan S
Quoted text here. Click to load it

A way to ask meaningful (meaning sufficiently complete) questions?

Hope this helps,

Site Timeline