Hello Brian,

first of all I wish you a Happy New Year !!!  :-)))

On Fri, Dec 15 2000, Brian Ingerson wrote:
> 
> I'm interested in knowing how your XS to Inline conversion goes. Your
> feedback could help me improve future versions.

Over the holidays I made my first tests how to convert my AFSperl
XS-module to Inline. And I run into some problems.

 o In the C-Cookbook you state that "a variable length argument list"
   must contain at least one element.  But with the XS interface it is
   possible to specify an empty list.  Well, for the moment I have a
   workaround but I just wonder if this restriction will stay for ever ?

 o If I make use of the possibility to have multiple Inline C sections I
   get a problem.  In order to demonstrate it, I have prepared a very
   simple test case. In the first section I specify a C function and in
   the second section I specify a second C function which is calling the
   first function.  I also call that first C function from the Perl
   code.  The call from the Perl code is working.  Then I call the
   second C function from the Perl code which is finally calling the
   first C function.  As soon as the first C function is called from the
   second C function I get an error that this function is "an undefined
   symbol".  The reason is that each C section is stored in a separate
   object library.

Is there anything I did wrong ? How I can avoid this problem ?  Is there
a way to propagate these different object libraries ?

I will definitely need this kind of functionality.  Because I need a
certain C function in different modules but I want to specify this
function only once and not in each module.


Cheers,

Norbert
-- 
   +-------------------------------------------------------------------+
   | Norbert E. Gruener           http://www.MPA-Garching.MPG.DE/~nog/ |
   | Max-Planck-Institut          <[EMAIL PROTECTED]>            |
   | fuer Astrophysik             PGP encrypted mail preferred         |
   | PGPprint(RSA):  66 64 C0 D0 6F 1A 16 02  C2 C6 37 83 3A 5F 88 9B  |
   | PGPprint(DH):  EBBF 02ED 1B91 39C3 5FB9  4D2F 9478 E224 334C 34CD |
   | PGPprint(DSS): A3F0 BDFA EAC0 128D A6C5  B11D 6EEC 0A88 47CD A77D |
   +-------------------------------------------------------------------+
use AutoLoader;

my $number = 30;
PRINT($number);
add(5, 6);

use Inline C => <<'END_OF_C_CODE';

void PRINT(int result) {
  printf("Result:  %d\n", result);
}

END_OF_C_CODE
use Inline C => <<'END_OF_C_CODE';

void add(int x, int y) {
    int z;

    z = x + y;
    printf("ADD:  %d\n", z);
    PRINT(z);
}

END_OF_C_CODE


Reply via email to