Now, I found a simple, but at least working solution :-))

On Fri, 07 Feb 2003 15:56:08 +0100, Janek Schleicher wrote:

> I want tu reuse existing c code from different c files. I neither have
> them as a real library, nor would I like to copy+paste them into my Perl
> module (after the __C__ tag). The reason for that is, that the original c
> code comes from an open source project of a standalone program (gnubg). I
> just don't want to reinvent the wheel and still be flexible enough for
> oncoming future versions of the program.
> 
> Is there a trick or a common known problem how to use normal c files via
> #include "file.h"
> with Inlince::C.
> 
> [...]
> __DATA__
> __C__
> 
> #include <errno.h>
> #include "positionid.h"

Here I just used instead
#include "gnubg/positionid.c"

> int _CheckPosition(AV* a) {
>     int i, j;
>     int anBoard[ 2 ][ 25 ];
>     for (i = 0; i < 2; i++) {
>         for (j = 0; j < 25; j++) {
>             SV** sv = av_fetch(a,25*i + j,0);
>             anBoard[ i ][ j ] = SvIV(*sv);
>         }
>         }
>     return CheckPosition(anBoard) == 0;
> }
> }


Cheerio,
Janek

Reply via email to