On Sun, 02 Mar 2008, Sisyphus wrote:
> Hi,
> Some time back I asked about the inability of XS to access
> Perl_report_uninit() on Win32 ... though the function is accessible from
> XSubs on linux. Jan Dubois explained thus:
> 
> --- quote ---
> "..Perl_report_uninit() is not a public Perl API, so extensions are not
> allowed to call it. On Linux this cannot be enforced as all internal symbols
> are being exported anyways, but on Windows (and AIX) you can only call APIs
> that are marked as "public" in the embed.fnc file in the core Perl
> distribution.
> 
> In general it is a good idea to check `perldoc perlapi`. If the function
> isn't listed in there, then you are not allowed to use them in an
> extension...."
> --- end quote ---
> 
> I've now started to wonder "why is it so?". That is, why *not* allow the
> calling of *all* functions on Win32 (as can be done in linux) ?
> 
> I don't doubt that there are good reasons for imposing these limitations ...
> I'm merely wondering what those "good reasons" are :-)

The reason is that those functions are not considered to be part of the
public Perl API. For all public APIs there is an effort to keep at least
source-level compatibility between Perl versions, even when they are no
longer binary compatible.

E.g. Perl 5.10 contains various legacy APIs from Perl 5.8 and earlier, either
as C implementations in the mathoms.c file, or as macro wrappers around
new functions. This avoids breaking any modules on CPAN that make use of
these APIs, even though the API may be implemented completely
differently in the new version. The legacy API isn't used by the core
itself anymore at all.

Making all APIs public would then "require" the Perl maintainers to
continue to support them for an unreasonable amount of time. These APIs
may be exposing implementation details that the core should be free to
change any time there is a need for it.

It can be argued that Perl already exposes way to much of its
implementation to the XS writer. This is handled much better by Tcl:
even though there are big changes in Tcl internal, you can use module
binaries built for any earlier version with the latest release without
having to recompile.

Cheers,
-Jan


_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to