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

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 PPPOE.pm 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? :-(

Comment on C to perl binding using XSLoader?
Select or Download Code
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.

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 marto (Bishop) on Jan 16, 2013 at 09:49 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1013517]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2015-07-03 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls