On Wed, 11 Apr 2001, Dan Sugalski wrote:

> *) All exported perl functions and functionlike things have a Perl_ prefix
> *) All exported data and dataish thigns have a PL_ prefix
> *) All private routines have #defines to give them a _Perl_ prefix
> *) All private data have #defines to give them a _PL_ prefix
> *) Internal data and functions get referenced via the unqualified names

> That way the internals can use the utility function str_to_UTF(), while the 
> world would see it (or, rather, not see it) as _Perl_str_to_UTF().

But think also about embedding applications.  If you want to embed perl
into another program that has its own str_to_UTF() function, then

        #include "myprogram.h"
        #include <perl.h>
        /* ... */
        str_to_UTF();

may get inadvertantly stuck with _Perl_str_to_UTF().

Offhand, I see at least three possible approaches:

1.  Don't ever have short names.  (Yuck, lots of typing, but that's
    ultimately how we got in the perl5 state).

2.  Don't have the #defines #included by <perl.h> by default (or have
    them only set #ifdef PERL_CORE or some such).

3.  Provide an unembed.h that un-does all those defines

        #include "myprogram.h"
        #include <perl.h>
        #include <perl/unembed.h>

Of course _that_ could still collide with a #define for str_to_UTF() in
myprogram.h, though this is starting to get less likely.

-- 
    Andy Dougherty              [EMAIL PROTECTED]
    Dept. of Physics
    Lafayette College, Easton PA 18042

Reply via email to