in reply to Re: [XS] Bizarre (scoping ?) problem with wrapping C library function (2 dlls)
in thread [XS] Bizarre (scoping ?) problem with wrapping C library function
SIS::GSL's XS file specifies:MODULE = gsl_error_pl_4227 PACKAGE = main
That's the only difference in the respective XS files. I've even gone so far as to rework SIS::GSL with the XS file containing:MODULE = SIS::GSL PACKAGE = SIS::GSL
That successfully transfers wrap_eror_handler_off and demo2_e into the 'main' namespace, but wrap_eror_handler_off still fails to do what it is supposed to do.MODULE = SIS::GSL PACKAGE = main
use warnings; use strict; use Inline C => Config => #BUILD_NOISY => 1, #CLEAN_AFTER_BUILD => 0, INC => '-IC:/_32/msys/1.0/local/include', LIBS => '-LC:/_32/msys/1.0/local/lib -lgslcblas -lgsl'; use Inline C => <<'EOC'; #include <stdio.h> #include <gsl/gsl_math.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_sf_gamma.h> #include <gsl/gsl_sf_coupling.h> #include <gsl/gsl_message.h> void wrap_error_handler_off() { gsl_set_error_handler_off(); } SV * demo2_e(int a1, int a2, int a3, int a4, int a5, int a6, int a7, i +nt a8, int a9) { gsl_sf_result r; gsl_sf_coupling_9j_e(a1, a2, a3, a4, a5, a6, a7, a8, a9, &r); return newSVnv(r.val); } EOC wrap_error_handler_off(); # '-2' is an invalid argument, so the following # returns a nan iff error handler is turned off. # Otherwise it dies with 'domain error' my $r = demo2_e(4, -2, 4, 3, 3, 2, 1, 1, 2); print $r, "\n";
|
|---|