Inline@perl.org
Please help.
Here's what I want to do.
>From a Perl routine, I want to call a Perl Inline callable "C" subroutine that 
>is essentially at the head of a rather large set of "C" routines [ way over 
>10,000 lines] that do a rather sophisticated task that I do not wish to 
>attempt to describe here.
I need the "C" "engine" that I've already built to do what it does without 
having to screw with it any more.  It is vulnerable to further development and 
maintenance errors that I wish to avoid.  It was written in Visual C++, but 
much of it is regular C.
I want Perl to do the front end and back end work of handling strings and other 
matters to get the data together to call the above described "C" subroutine 
"engine" through the use of Inline C.
I want to pass a small set of variables - about 10 or so - to the Perl callable 
"C" routines.
 foo (var1, var2, var3, var4, var5, var6, var7, var8, var9, var10 );
[I could pass another blank variable that sends back an array of real numbers, 
if that could be made to work. ie.
 foo (var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, var11 );]
The goal is that I want to get an indefinitely large array of real number 
results back from the called routine.
That's it.
It seems simple, but it has become a nightmare.
I am running version Perl 5.10.0, the latest and greatest version I could 
find.  Also the latest version of Inline, version 0.44.
I am on a PC running Windows 2000, and using active state .
The following line "works" when tested in a very small routine.
    [EMAIL PROTECTED] = map {$_} foo (var1, var2, var3, var4, var5, var6, var7, 
var8, var9, var10 );
In this example, I use the following stack method in the "C" routine to pass 
back what I want as this array:
      Inline_Stack_Reset;
      Inline_Stack_Push(sv_2mortal(newSViv(arg)));
 ...
      Inline_Stack_Done;
However, apparently, declaring an exactly similar Perl callable subroutine in 
the huge set of "C" routines doesn't work. 
 void foo (var1, var2, var3, var4, var5, var6, var7, var8, var9, var10 );
This does not work.
It gets the following error -
 "Can't locate auto/foo.al in @INC "
Other people have apparently gotten this error, as described in various posts 
to the net.  And, yes, I checked the spelling of the called routine. It just 
won't work.
Therefore the following will also not work
    [EMAIL PROTECTED] = map {$_} foo (var1, var2, var3, var4, var5, var6, var7, 
var8, var9, var10 );
Because, once I declare:
 int foo (var1, var2, var3, var4, var5, var6, var7, var8, var9, var10 );
the integer declaration means that the return array disappears from the stack, 
and I have no real array.
Let me say it again.  
The usage of void foo () and the above map method actually works, but only when 
used with tiny itsy bitsy stubbed out routines.  It does not work when actual 
usage is attempted in the actual much larger set of routines.   And, yes, I 
have checked the spellings.  They're correct. This usage of the Perl stack ust 
does not work.
It would seem to be an impossible task to do what should work to get this 
results array back from the call. The error is a strange one that makes no 
sense, but I have to get the job done anyway.
I need a method for this that WILL work.
If I cannot use the Perl stack as above to get the array back from the 
subroutine, how in the heck can I get what I need to get done ?
Is there some way to safely and securely pass an arbitrarily large set of 
information in an array back from the called "C" routine ?
Tests that work on tiny itsy bitsy stubbed out routines in seconds take more 
than 20 minutes to compile on my big set of "C" routines, so the frustration 
level here is pretty high.
Please help.
Thanks.
Mike.

Reply via email to