develooper Front page | perl.perl5.porters | Postings from August 2011

API to explicitly select to export XSUB symbols or not

Thread Next
From:
Jan Dubois
Date:
August 11, 2011 12:49
Subject:
API to explicitly select to export XSUB symbols or not
Message ID:
008501cc585f$cfc01070$6f403150$@activestate.com
On Thu, 11 Aug 2011, Steffen Mueller wrote:
> commit e64345f82d66a32f6da47acf482e7e6c9282b433
> Author: Steffen Mueller <smueller@cpan.org>
> Date:   Thu Aug 11 13:21:05 2011 +0200
> 
>     API to explicitly select to export XSUB symbols or not
> 
>     This adds a few additional macros to XSUB.h:
>     XS_INTERNAL and XS_EXTERNAL are versions of the XS macro
>     that explicitly use internal (static) linking or not.
>     XSPROTO_INTERNAL and XSPROTO_EXTERNAL are the obvious equivalents
>     for XSPROTO (which is apparently not public yet we support its
>     use in SWIG...).
> 
>     The XS and XSPROTO macros themselves are not defined to not
>     use STATIC, but this may (should?) be changed in the future.

I left some comments on IRC, but you were already gone...

I don't think XS_EXTERNAL is really needed; the symbols are already all
internal by default on Windows (and AIX). To export anything but the
default bootstrap function requires you to add the symbols to FUNCLIST
in your Makefile.PL.

Looking at existing samples, like B::Hooks::OP::Check, or Gtk2, they
all seem to export regular C functions and not XS code.

So I doubt that many (any?) existing modules intentionally export
XS symbols, and I don’t think it is a desirable new feature either.
It is much easier to call plain C code from a different module
than XS code, which really should only be called through Perl.

Cheers,
-Jan



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About