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 ) ; >; print erf(0); print 
erf(1);'


It addects only C/grammar/grammar.pm.  Is there any interest in this?
Would there be more interest if you could drop the argument names
(like you can in real C)?

The diffs start *after* the blank line *after* the dots.

Brian -- is this the right place for such patches & discussion?

................ diff -c C/grammar/grammar.pm ../Inline-0.40/C/grammar/grammar.pm 
................

*** C/grammar/grammar.pm        Thu May 31 17:17:05 2001
--- ../Inline-0.40/C/grammar/grammar.pm Sun Apr 29 20:34:33 2001
***************
*** 27,37 ****
        | m{\s* /\* (?:[^*]+|\*(?!/))* \*/  ([ \t]*)? }x
  
  function_definition:
!       rtype IDENTIFIER '(' <leftop: arg ',' arg>(s?) ')' function_part
        {[@item[2,1], $item[4]]}
  
- function_part: '{' | ';'
- 
  rtype:  TYPE star(s?)
          {
           $return = $item[1];
--- 27,35 ----
        | m{\s* /\* (?:[^*]+|\*(?!/))* \*/  ([ \t]*)? }x
  
  function_definition:
!       rtype IDENTIFIER '(' <leftop: arg ',' arg>(s?) ')' '{'
        {[@item[2,1], $item[4]]}
  
  rtype:  TYPE star(s?)
          {
           $return = $item[1];

................ end diffs ................

-- 
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