Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

C to perl binding using XSLoader?

by PerlRider (Initiate)
on Jan 16, 2013 at 07:23 UTC ( #1013517=perlquestion: print w/replies, xml ) Need Help??
PerlRider has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am trying to bind the C DLL with Perl using XSLoader. I got the following error: Can't find 'boot_PPPOE' symbol in ./auto/PPPOE/PPPOE.dll My C DLL (PPPOE.dll) is only having couple of function definations.

#PPPOE module package PPPOE; use 5.006001; use strict; use warnings; use Carp; 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('PPPOE', $VERSION); 1; __END__
#calling Perl script #! /usr/bin/perl use strict; use warnings; use PPPOE;
From the above error, I expect that C DLL should have some specific syntax. Can someone please share the ideas? :-(

Replies are listed 'Best First'.
Re: C to perl binding using XSLoader?
by marto (Bishop) on Jan 16, 2013 at 09:49 UTC
Re: C to perl binding using XSLoader?
by tobyink (Abbot) on Jan 16, 2013 at 08:00 UTC

    XSLoader is not for loading code written in C; it is for code written in XS. Yes, XS is C, but thanks to preprocessing it's such a strange dialect of C that it's barely recognizable as C at all.

    Here's a fairly small example of a module that uses XS including the XS (C) code, a Makefile.PL, and other support files. Feel free to use it as a crib sheet.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: C to perl binding using XSLoader?
by Corion (Pope) on Jan 16, 2013 at 07:58 UTC

    You will need to show the relevant parts of your XS file too. Also see perlxstut for a start with XS.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1013517]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-03-21 08:13 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (265 votes). Check out past polls.