Looking at the source code for gsl-1.15, I see that 'gsl_complex_rect' is compiled as an inline function and should not be imported. On OSX it crashed - CORRECTION the code in the next post works not only on Windows but also OSX.
I guess this inline function exists in the gsl library because many of its functions take complex values. For these functions you could declare a structure using the newLISP function 'struct:
Code: Select all
(struct 'complex "double" "double")
(import "ffitest.dylib" "complex_test" "complex" "complex")
(complex_test (pack complex 3.0 4.0)) ;=> (3 4)
; you also could pass the numbers in a list - from a previous result
(complex_test (pack complex '(3 4))) ;=> (3 4)
in this example 'complex_test takes a parameter of type complex and returns a complex value. This is the C-source of
gsl_complex complex_test(gel_complex), which I used on Mac OSX:
Code: Select all
/* gcc -m32 ffitest.c -shared -o ffitest.dylib */
typedef struct
{
double dat[2];
} gsl_complex;
gsl_complex complex_test(gsl_complex gs)
{
return(gs);
}
the function simply returns its input value and displayed as a list.
See the next post making "gsl_complex_rect" work on Both Mac OSX and Windows.