Yes, missing typemap entries will trigger uninit warnings in Inline::CPP; I have seen it many times. I ended up patching my copy to report what type conversion was failing. I may have even filed a bug; I can't remember. It's a little tangled up in a problem with error reporting being mishandled.
But why are you using double* instead of a plain double? double* is ambiguous; you'll need to explain to it somehow what you mean by that. A return value? An array? A pointer to a single double to make it fit nicely into a single word? An image buffer that is really an array of RGB triples in which you are supposed to draw the answer in a comical font? I'm surprised at dgamlm(xmin, xmax). I didn't realize XS knew about references. On Tue, Jun 9, 2009 at 7:11 AM, ARTHUR GOLDBERG <a...@cs.nyu.edu> wrote: > Thanks much Rob > > The versions are > $ perl -le 'require Inline;print $Inline::VERSION' > 0.45 > $ perl -le 'require Parse::RecDescent;print $Parse::RecDescent::VERSION' > 1.94 > > FWIW my sense is that the uninitialized hash value leads to a missing entry > in the typemap for 'double *'. I can recreate the compilation error with > this test code, which works fine with the C++ function addDouble removed: > > #!/usr/bin/perl >> use warnings; >> use lib '/opt/local/lib/perl5/site_perl/5.8.9/'; >> >> print "9 + 16 = ", add(9, 16), "\n"; >> >> use Inline CPP => <<'END'; >> >> int add(int x, int y) { >> return x + y; >> } >> >> double addDouble( double *x, double *y ) { >> return x[0] + y[0]; >> } >> >> END >> >> > > Below are lines 875 ff from > /private/var/vpfiles/_Inline/build/VirtualPlant/Analysis/Correlation/CorrelationCalc_fa1b/CorrelationCalc_fa1b.xs > >> double >> BetaI(x, pin, qin) >> double x >> double pin >> double qin >> >> double >> LnBeta(a, b) >> double a >> double b >> >> double >> d9lgmc(x) >> double x >> >> double >> LogRel(x) >> double x >> >> double >> LnGamma(x) >> double x >> >> double >> Gamma(x) >> double x >> >> int >> initds(os, nos, eta) >> double * os >> int nos >> double eta >> >> double * >> getFlArray(sv) >> SV * sv >> >> void >> dgamlm(xmin, xmax) >> double & xmin >> double & xmax >> PREINIT: >> I32 * __temp_markstack_ptr; >> PPCODE: >> __temp_markstack_ptr = PL_markstack_ptr++; >> dgamlm(xmin,xmax); >> if (PL_markstack_ptr != __temp_markstack_ptr) { >> /* truly void, because dXSARGS not invoked */ >> PL_markstack_ptr = __temp_markstack_ptr; >> XSRETURN_EMPTY; /* return empty stack */ >> } >> /* must have used dXSARGS; list context implied */ >> return; /* assume stack size is correct */ >> >> double >> dcsevl(x, cs, n) >> double x >> double * cs >> int n >> >> double >> Dint(d) >> double d >> >> >> > > Also, ultimately I think it would be great to modify the Inline CPP's > Makefile.PL so that it selects the right compiler and library on Mac OS X. > > BR > A > > > On Jun 9, 2009, at 9:07 AM, Sisyphus wrote: > > >> ----- Original Message ----- From: "ARTHUR GOLDBERG" <a...@cs.nyu.edu> >> >> and the compilation finally dies with >>> >>>> /usr/bin/perl /System/Library/Perl/5.8.8/ExtUtils/xsubpp -typemap / >>>> System/Library/Perl/5.8.8/ExtUtils/typemap CorrelationCalc_fa1b.xs >>>> > CorrelationCalc_fa1b.xsc && mv CorrelationCalc_fa1b.xsc >>>> CorrelationCalc_fa1b.c\nError: 'double *' not in typemap in >>>> CorrelationCalc_fa1b.xs, line 904\nError: 'double *' not in typemap >>>> in CorrelationCalc_fa1b.xs, line 910\nError: 'double *' not in >>>> typemap in CorrelationCalc_fa1b.xs, line 932\nmake: *** >>>> >>> >> I should know how to generate that error ... but apparently I don't. >> Could you provide us with lines 904, 910 and 932 of >> >> /private/var/vpfiles/_Inline/build/VirtualPlant/Analysis/Correlation/CorrelationCalc_fa1b/CorrelationCalc_fa1b.xs >> (and maybe a few lines either side for context, if you think that might >> help). >> >> Also, what version of Inline, and what version of Parse::RecDescent do you >> have: >> perl -le 'require Inline;print $Inline::VERSION' >> perl -le 'require Parse::RecDescent;print $Parse::RecDescent::VERSION' >> >> Cheers, >> Rob >> >> >> >> >