J
JNye
I'm attempting to use the perl extension mechanism, h2xs,xsubpp, etc.
I receive this error message at run time:
Can't find 'boot_DefRd2' symbol in
<snipped>/DefRd2/blib/arch/auto/DefRd2/DefRd2.so
DefRd2 is my package.
I have three routines called from a test program, dft.pl:
- a straight perl call to a perl sub DefRd2.pm,
- a call to a C extension, where C code is above the
module/package statement in the xs file
- a linked C call, specified in the xs file but C code is
in an external .o file, linked via OBJECT in Makefile.PL
(this C routine lives in an external file called
LinkedCBasicTest.c)
All three routines require no arguments and return no values.
They simply print a string.
The straight perl call and the in-line C call work fine. The linked C
call fails with the above error message, unless
commented out.
Compilation occurs without any warnings/errors (other than those caused
by stripping out the ABSTRACT to shorten my code included below.)
Does anyone have an idea what I'm doing wrong here? Seems like a
straight forward test, I must be missing some detail somewhere.
At first I thought I was having an issue with dynamic libaries but
what's confusing is that the in-line C code works fine.
So I'm thinking either a MakeMaker misuse or xsubpp switch is missing.
Any thoughts/help would be appreciated.
=======================
Original h2xs invocation was:
h2xs -A -n DefRd2 <= my package name
=======================
DefRd2.xs contents <minus comments and such>:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
void InLineCBasicTest (void) {
printf("In line C basic test output\n");
}
MODULE = DefRd2 PACKAGE = DefRd2
void
InLineCBasicTest()
void
LinkedCBasicTest()
=======================
The test script which contains the calls to straight perl, in-line C
and linked C was invoked as:
perl -Mblib dft.pl
=======================
dft.pl contains:
use strict;
use warnings;
use DefRd2;
&DefRd2::InLineCBasicTest;
&DefRd2:MPerlBasicTest;
&DefRd2::LinkedCBasicTest;
=======================
DefRd2.pm contains:
package DefRd2;
use 5.008003;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
);
our $VERSION = '0.01';
require XSLoader;
XSLoader::load('DefRd2', $VERSION);
sub PMPerlBasicTest { print "Package perl basic test output\n"; }
1;
=======================
Makefile.PL contains:
use 5.008003;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'DefRd2',
VERSION_FROM => 'lib/DefRd2.pm',
PREREQ_PM => {},
($] >= 5.005 ?
(ABSTRACT_FROM => 'lib/DefRd2.pm',
AUTHOR => 'X X. X <'"x@x>') : ()),
LIBS => [''],
DEFINE => '',
INC => '-I.',
OBJECT => 'LinkedCBasicTest.o',
);
=======================
LinkedCBasicTest.c contains:
#include <stdio.h>
void LinkedCBasicTest (void) {
printf("Lined c basic test output\n");
}
=======================
perl version 5.8.6 <upgraded from 5.8.3>
h2xs version 1.2.3 < same for 5.8.3 and 5.8.6>
on RH Fedora 2
I receive this error message at run time:
Can't find 'boot_DefRd2' symbol in
<snipped>/DefRd2/blib/arch/auto/DefRd2/DefRd2.so
DefRd2 is my package.
I have three routines called from a test program, dft.pl:
- a straight perl call to a perl sub DefRd2.pm,
- a call to a C extension, where C code is above the
module/package statement in the xs file
- a linked C call, specified in the xs file but C code is
in an external .o file, linked via OBJECT in Makefile.PL
(this C routine lives in an external file called
LinkedCBasicTest.c)
All three routines require no arguments and return no values.
They simply print a string.
The straight perl call and the in-line C call work fine. The linked C
call fails with the above error message, unless
commented out.
Compilation occurs without any warnings/errors (other than those caused
by stripping out the ABSTRACT to shorten my code included below.)
Does anyone have an idea what I'm doing wrong here? Seems like a
straight forward test, I must be missing some detail somewhere.
At first I thought I was having an issue with dynamic libaries but
what's confusing is that the in-line C code works fine.
So I'm thinking either a MakeMaker misuse or xsubpp switch is missing.
Any thoughts/help would be appreciated.
=======================
Original h2xs invocation was:
h2xs -A -n DefRd2 <= my package name
=======================
DefRd2.xs contents <minus comments and such>:
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
void InLineCBasicTest (void) {
printf("In line C basic test output\n");
}
MODULE = DefRd2 PACKAGE = DefRd2
void
InLineCBasicTest()
void
LinkedCBasicTest()
=======================
The test script which contains the calls to straight perl, in-line C
and linked C was invoked as:
perl -Mblib dft.pl
=======================
dft.pl contains:
use strict;
use warnings;
use DefRd2;
&DefRd2::InLineCBasicTest;
&DefRd2:MPerlBasicTest;
&DefRd2::LinkedCBasicTest;
=======================
DefRd2.pm contains:
package DefRd2;
use 5.008003;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
);
our $VERSION = '0.01';
require XSLoader;
XSLoader::load('DefRd2', $VERSION);
sub PMPerlBasicTest { print "Package perl basic test output\n"; }
1;
=======================
Makefile.PL contains:
use 5.008003;
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'DefRd2',
VERSION_FROM => 'lib/DefRd2.pm',
PREREQ_PM => {},
($] >= 5.005 ?
(ABSTRACT_FROM => 'lib/DefRd2.pm',
AUTHOR => 'X X. X <'"x@x>') : ()),
LIBS => [''],
DEFINE => '',
INC => '-I.',
OBJECT => 'LinkedCBasicTest.o',
);
=======================
LinkedCBasicTest.c contains:
#include <stdio.h>
void LinkedCBasicTest (void) {
printf("Lined c basic test output\n");
}
=======================
perl version 5.8.6 <upgraded from 5.8.3>
h2xs version 1.2.3 < same for 5.8.3 and 5.8.6>
on RH Fedora 2