First let my appologize if this isn't the right place to ask this question, my first time asking about perl online.
ok, I am a VERY novice perl user but an experienced C programmer. I want to use Inline C to create a module(C subs) that I can call from perl scripts. I have written a perl script that works with the C code in the script but I want to move the C code to a module so others can call it from other scripts. When I try to execute the script I get the following message: Undefined subroutine &main::pltc called at ./dtcp line 60. Any help would be appreciated(heaven = a_full_example + procedure;), -parman- (at least thats my goal)
perl script(dtcp):
#!/usr/bin/perl -W
use MYMODU::mystuff;
pltc();
module(MYMODU::mystuff):
package MYMODU::mystuff;
#note: this module originally generated using 'h2xs -PAXn MYMODU::myst
+uff
require 5.005_62;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not expo
+rt
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
# This allows declaration use MYMODU::mystuff ':all';
# If you do not need this, moving things directly into @EXPORT or @EXP
+ORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );
use base 'Exporter';
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
pltc
);
our $VERSION = '0.02';
use Inline C => 'DATA',
VERSION => '0.02',
NAME => 'MYMODU::mystuff';
__DATA__
=pod
=cut
__C__
use Inline C => Config => INC =>
'-I/perlib/MYMODU/mystuff/blib/arch/auto/MYMODU/mystuff
';
use Inline C => Config => LIBS =>
'-L/perlib/MYMODU/mystuff/blib/arch/auto/MYMODU/mystuff
-L/perlib/MYMODU/mystuff
-lmytclib
';
int pltc(SV* var1, char *name) {
sv_setpvn(var1, dumm, strlen(dumm));
exit(1);
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.