Hi,
The code:
#!perl -w
use Inline C => <<'END_OF_C_CODE';
void dumb ( int x, int y) {
SV* c;
SV* d;
c = x * y;
d = x + y;
printf("%d\n", c);
printf("%d\n", d);
Inline_Stack_Vars;
Inline_Stack_Reset;
Inline_Stack_Push(c);
Inline_Stack_Push(d);
Inline_Stack_Done;
/* Inline_Stack_Return(2); */
}
END_OF_C_CODE
dumb(4, 28);
###################################
Can someone show me how to write that in such a way that it will build ?
All I'm trying to do is take 2 integers, and push their sum and their
product onto the stack. That achieved, I would then like the function to
return the values that are on the stack........ but first things first, I
can't even get them onto the stack !
If I comment out all of the 'Inline_Stack_' commands it builds ok and runs
as expected. But the way it is, 'out.make' reports the errors listed below.
I suspect that if I could get around the problem regarding 'levels of
indirection', then I would have my answer - but I haven't been able to
achieve this yet.
Cheers,
Rob
----------------------------------------------------
warning C4047: '=' : 'struct sv *' differs in levels of indirection from
'int '
warning C4047: '=' : 'struct sv *' differs in levels of indirection from
'int '
error C2143: syntax error : missing ';' before 'type'
error C2143: syntax error : missing ';' before 'type'
error C2275: 'I32' : illegal use of this type as an expression
D:\Perl\lib\CORE\handy.h(125) : see declaration of 'I32'
error C2146: syntax error : missing ';' before identifier 'ax'
error C2065: 'ax' : undeclared identifier
error C2065: 'mark' : undeclared identifier
error C2113: pointer can only be subtracted from another pointer
error C2275: 'I32' : illegal use of this type as an expression
D:\Perl\lib\CORE\handy.h(125) : see declaration of 'I32'
error C2146: syntax error : missing ';' before identifier 'items'
error C2065: 'items' : undeclared identifier
error C2065: 'sp' : undeclared identifier
warning C4047: '<' : 'struct sv ** ' differs in levels of indirection from
'const int '
warning C4047: 'function' : 'struct sv ** ' differs in levels of indirection
from 'int '
warning C4024: 'Perl_stack_grow' : different types for formal and actual
parameter 2
warning C4047: 'function' : 'struct sv ** ' differs in levels of indirection
from 'int '
warning C4024: 'Perl_stack_grow' : different types for formal and actual
parameter 3
warning C4047: '=' : 'int ' differs in levels of indirection from 'struct sv
** '
error C2100: illegal indirection
warning C4047: '=' : 'int ' differs in levels of indirection from 'struct sv
*'
error C2106: '=' : left operand must be l-value
warning C4047: '<' : 'struct sv ** ' differs in levels of indirection from
'const int '
warning C4047: 'function' : 'struct sv ** ' differs in levels of indirection
from 'int '
warning C4024: 'Perl_stack_grow' : different types for formal and actual
parameter 2
warning C4047: 'function' : 'struct sv ** ' differs in levels of indirection
from 'int '
warning C4024: 'Perl_stack_grow' : different types for formal and actual
parameter 3
warning C4047: '=' : 'int ' differs in levels of indirection from 'struct sv
** '
error C2100: illegal indirection
warning C4047: '=' : 'int ' differs in levels of indirection from 'struct sv
*'
error C2106: '=' : left operand must be l-value
warning C4047: '=' : 'struct sv ** ' differs in levels of indirection from
'int '
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.