[32963] in Perl-Users-Digest
Perl-Users Digest, Issue: 4239 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 20 05:17:18 2014
Date: Fri, 20 Jun 2014 02:17:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 20 Jun 2014 Volume: 11 Number: 4239
Today's topics:
Re: Need feedback on XS file <kw@codebykevin.com>
Re: Need feedback on XS file <rweikusat@mobileactivedefense.com>
Re: Need feedback on XS file <kw@codebykevin.com>
Re: Need feedback on XS file <rweikusat@mobileactivedefense.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 19 Jun 2014 09:45:14 -0400
From: Kevin Walzer <kw@codebykevin.com>
Subject: Re: Need feedback on XS file
Message-Id: <lnupha$o5l$1@dont-email.me>
On 6/17/14, 11:59 AM, Rainer Weikusat wrote:
> Suggestion: Write your interface routines in C and use h2xs to generate
> the infrastructure for a proper extension module. This will include XS
> stubs for enabling perl to call the C subroutines which will 'usually
> just work' (and if they don't, fixing them up is easier than writing
> them from scratch).
h2xs just slurps up header files rather than converting actual C files,
correct? So I can't just feed it my C code for conversion to XS but
instead would have to implement the code myself?
--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
------------------------------
Date: Thu, 19 Jun 2014 15:06:09 +0100
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Need feedback on XS file
Message-Id: <8761jx56zy.fsf@sable.mobileactivedefense.com>
Kevin Walzer <kw@codebykevin.com> writes:
> On 6/17/14, 11:59 AM, Rainer Weikusat wrote:
>> Suggestion: Write your interface routines in C and use h2xs to generate
>> the infrastructure for a proper extension module. This will include XS
>> stubs for enabling perl to call the C subroutines which will 'usually
>> just work' (and if they don't, fixing them up is easier than writing
>> them from scratch).
>
> h2xs just slurps up header files rather than converting actual C
> files, correct? So I can't just feed it my C code for conversion to XS
> but instead would have to implement the code myself?
It generates (or is supposed to generate) XS-stubs (and 'other
infrastructure', eg, a Makefile.PL and a bare-bones Perl module) for
calling some set of C routines based on a header file containing
prototypes for them (and associated stuff, eg, #defined constants).
This means you can write such a header and use that as base for h2xs.
------------------------------
Date: Thu, 19 Jun 2014 10:31:01 -0400
From: Kevin Walzer <kw@codebykevin.com>
Subject: Re: Need feedback on XS file
Message-Id: <lnus74$e9q$1@dont-email.me>
On 6/19/14, 10:06 AM, Rainer Weikusat wrote:
> It generates (or is supposed to generate) XS-stubs (and 'other
> infrastructure', eg, a Makefile.PL and a bare-bones Perl module) for
> calling some set of C routines based on a header file containing
> prototypes for them (and associated stuff, eg, #defined constants).
> This means you can write such a header and use that as base for h2xs.
OK, got it. I already tried that. Most of the examples I found in the
XSUB tutorial show vanilla C code being re-implemented as XSUB bits;
nothing as complicated as what I am doing with my code. I've consulted a
few CPAN projects that call into Mac system libraries and they are
simply incomprehensible to me.
I may have to try a different approach. Thanks for your feedback.
--Kevin
--
Kevin Walzer
Code by Kevin/Mobile Code by Kevin
http://www.codebykevin.com
http://www.wtmobilesoftware.com
------------------------------
Date: Thu, 19 Jun 2014 16:33:04 +0100
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Need feedback on XS file
Message-Id: <87wqcc52z3.fsf@sable.mobileactivedefense.com>
Kevin Walzer <kw@codebykevin.com> writes:
> On 6/19/14, 10:06 AM, Rainer Weikusat wrote:
>> It generates (or is supposed to generate) XS-stubs (and 'other
>> infrastructure', eg, a Makefile.PL and a bare-bones Perl module) for
>> calling some set of C routines based on a header file containing
>> prototypes for them (and associated stuff, eg, #defined constants).
>> This means you can write such a header and use that as base for h2xs.
>
> OK, got it. I already tried that. Most of the examples I found in the
> XSUB tutorial show vanilla C code being re-implemented as XSUB bits;
> nothing as complicated as what I am doing with my code. I've consulted
> a few CPAN projects that call into Mac system libraries and they are
> simply incomprehensible to me.
Just in case I wasn't being clear enough: The IMHO easiest way to create
an 'original' (not based on an existing library) perl extension is
1. Write a .c-file which provides the intended functionality.
2. Write a .h-file documenting interface implemented in the .c-file
3. Use h2xs and the .h-file to get a 'base module'.
Some additional work is necessary on the h2xs output, eg, the
Makefile.PL needs to be edited to make it compile the .c-file as part of
building the extension module.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 4239
***************************************