Brian Ingerson <[EMAIL PROTECTED]> writes:

> Ariel Scolnicov wrote:
> > 
> > It's currently not possible to use Inline::C to wrap a function
> > without defining it.  For instance, if I want to use the (POSIX?) -lm
> > library's erf() function, I'd have to say
> > 
> >         perl -le 'use Inline C => q<double i ( double x ) { return ierf ( x ) ; 
>}>; print i(0); print i(1);'
> > 
> > Here's a patch to the Inline-0.40 distribution to allow you to say
> > just
> > 
> >         perl -le 'use Inline C => q<double erf ( double x ) ; >; 
> 
> Inline has always been centered around defining wrapper functions. Now
> you can definitely do this:
> 
> ---8<---
> use Inline::Files;
> use Inline C => BELOW => PREFIX => 'X_';
> print erf(0), "\n"; 
> print erf(1), "\n";
> __C__
> double X_erf(double x) { return erf(x); }
> ---8<---
> 
> So the Perl interface is preserved.

Neat.  I hadn't realised that.

It's still not what I want, though.  I want essentially to feed a
library's header file into Inline, more-or-less verbatim, and get a
wrapper.  In another message on a different branch of the thread, I
mention the 4-letter word S-W-I-G...

[...]

> > Brian -- is this the right place for such patches & discussion?
> 
> Oh definitely. And patches are always very much appreciated. (Doesn't
> mean they'll always get in) A great way to say *exactly* what you mean!

Unfortunately I think I generated the patch backwards ("diff -c new
old" instead of "diff -c old new").  Hope it's not a problem.  After
all, Larry Wall wrote `patch'!

-- 
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | [EMAIL PROTECTED]
Compugen Ltd.          |Tel: +972-2-5713025 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658117 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

Reply via email to