Dear Inliners:
I have come across what I think may be a bug in Brian's magnificent module,
or (more likely) a bug in my brain. I am using version 0.30 of Inline, and
version 1.0 of my brain.
Sometimes when I fiddle with the parameters passed to an inline'd sub, I get
this sort of error:
Error: invalid argument declaration 'dance_steps' in main_blah_blah.xs, line
39.
The offending declaration is always (so far) a pointer. I have had
previously working subroutines break by removing a preceding parameter
(typically an int).
Snippet one below generates just such an error. Snippet two contains the
offending bit of the resulting xs file. Note that there is no type for the
offending parameter. Shouldn't it say "int *dance_steps" ?
Thanks for any clarification you can give on this,
Eric
---------8<--snippet one-----------------------
#!/usr/bin/perl -w
use strict;
my $dance = 100;
two_step($dance);
exit;
use Inline C => <<'END_OF_C_CODE';
void steps(int *dance_steps)
{
printf("I can only hope to get this far\n");
}
void two_step(int steps)
{
int *dance = NULL;
dance = (int*)malloc(steps*sizeof(int));
if (dance=NULL)
handle_error(1, 1);
steps(dance);
free(dance);
}
handle_error (int err_no, int trap)
{
printf("Could not allocated sufficient memory! (Error #1 at trap %d)\n\n",
trap);
exit(0);
}
END_OF_C_CODE
-------8<--snippet two---------------------------
<snip>
PROTOTYPES: DISABLE
void
steps (dance_steps)
dance_steps
<snip>