On Fri, 12 Jul 2002, C. Church wrote:

>     Any ideas as to what I'm doing wrong?

I think the problem is that by specifying a return type of "char *" you're
telling Inline::C that you'll be returning a standard C-style
NULL-terminated string.  But your data is binary and probably has embedded
NULL bytes in it that don't mark the end of the string.

One solution would be to specify a return type of "SV *" and build the SV
manually using the Perl API functions.  To do that change the signature of
your function to:

   SV * sinewave2(double samplerate, double frequency)

Then, at the end, instead of returning a "char *", build a "SV *" with
newSVpvn:

  return newSVpvn((char *) array, ((44099 * sizeof(short))/sizeof(char));

I haven't tested it, but I think that should give you what you're looking
for.

-sam



Reply via email to