On Mon, Dec 30, 2002 at 12:30:41AM -0800, _brian_d_foy wrote:
> In article <[EMAIL PROTECTED]>, Philip Newton
> <[EMAIL PROTECTED]> wrote:
> 
> > On Sun, 29 Dec 2002 02:56:42 -0800, [EMAIL PROTECTED] (_brian_d_foy)
> > wrote:
> > 
> > > * How can I call my system's unique C functions from Perl?
> > >    + mentioned specific modules, Win32::API and Mac::Carbon. if
> > >    anyone knows of other modules i should mention, please let
> > >    me know.
> > 
> > Inline::C?
> 
> good suggestion.  i'll rewrite the answer after other people have
> had a chance to comment.

That would be "us", the silent masses?

It's a good suggestion, as (in my opinion) what Inline::C is particularly
good at is letting people create calls from Perl into the C they know,
without having to learn the internals first. (Compared with XS, where you do
have to start understanding the internals API much earlier). And it's this
sort of "how do I call C from Perl?" problem which the FAQ question is
about. (Inline::C is still nice for people who do know the internals, as it
lets you not have to remember them, or get them wrong)

The other piece of advice, which I think is becoming generally accepted
wisdom, is that it's better to prototype your API in Perl until you are
happy with it, rather than in C (or XS, or Inline C). What this means is do
the minimum work to expose the C interface to Perl (possibly with things like
pre-sized fixed length buffers) and then write a prototype layer Perl code
to map that to a native perlish API. Only when you're happy with the feel of
your perlish API do you start to convert that to C (or XS). And if it's fast
enough as is, why bother?

Nicholas Clark

Reply via email to