On Sun, 2006-03-19 at 12:53 -0500, Liam M. Healy wrote: > - The desktop is ..., Darcs pull 2006-03-07 23:11, SBCL 0.9.8.42 > - The laptop is ..., Darcs pull 2006-03-17 23:59, SBCL 0.9.9
This may or may not be an issue. > (with-foreign-objects ((retn :double)) > (foreign-funcall "gsl_sf_bessel_Jn_array" > :int 0 > :int 2 > :double 0.25d0 > :pointer retn > :int) > (mem-aref retn :double 0)) I know nothing about GSL besides what I just read about the function you call above, but don't you need to allocate space for 3 doubles, not just one, for the retn (result_array) argument? Function: int gsl_sf_bessel_Jn_array (int nmin, int nmax, double x, double result_array[]) This routine computes the values of the regular cylindrical Bessel functions J_n(x) for n from nmin to nmax inclusive, storing the results in the array result_array. The values are computed using recurrence relations for efficiency, and therefore may differ slightly from the exact values. > - All functions I've tried that return a pointer to an array of doubles > have this problem. > - Sometimes the problem behavior varies. For example, If the third > argument is 0.5d0, SBCL simply locks up instead of crashing. > Sometimes I get an infinite output of error messages that repeat the > line "mprotect: Cannot allocate memory" over and over. > > Any debugging advice? If the above didn't help, try to rewrite the crashing behavior using SB-ALIEN: http://www.sbcl.org/manual/Foreign-Function-Interface.html If you still get the crash, it may be an issue with misinterpretation, or SB-ALIEN. Otherwise, it may be a problem with how CFFI uses SB-ALIEN. -- Stephen Compall http://scompall.nocandysw.com/blog
signature.asc
Description: This is a digitally signed message part
_______________________________________________ cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel