On Thu, Sep 28, 2000 at 08:59:58PM -0000, Perl6 RFC Librarian wrote:
> =head1 DESCRIPTION
>
> Any sub that has the appropriate attribute can be called from C (or some other
> compiled language). Perl will automagically convert the input
> parameters (which is what the attributes tells us) to things perl can
> use, and be off and running.
>
> Prototypes are insufficient to the task, as they don't get detailed
> enough, nor do they detail the return value (which does need to be a
> single thing)
>
> This means that a sub like this:
>
> sub foo : C_visible("i", "iii") {#sub body}
> Perl will generate vararg functions on the fly for any sub with the
> appropriate attribute. This is very platform specific, unfortunately,
> but there's no real way around it. The generated function doesn't need
> to be all that funky--one that knows the address of the 'real' perl
> sub's coderef and that knows how to slurp in the passed in parameters
> is sufficient.
Are you suggesting that the attributes use the same mapping system as
the XS (or son-of-XS (XS++)) typemaps in lib/ExtUtils/typemap?
If so, will there be the "terse" column in the typemap file to associate
"i" with "T_IV" ?
To me it would seem sensible to define the mapping from perl to C types
and from C to perl types just once, and use it both for calling external
libraries, and for being called by external things
Nicholas Clark