mathprof@bigfoot.com wrote:
>
> Thanks! Based on this, I created a file called "test.c" as follows:
>
> #include <math.h>
> float pg_sin(float *x) {return(sin(*x));}
>
> and compiled it using: "gcc test.c -lm -shared" to create a shared object
> file. I then tried the same steps as below (substituting
> "/usr/lib/libm.so" with the path to my "a.out" file created by gcc), but
> this still didn't work? I'm getting different wrong values, but they're
> still wrong nonetheless?
The return has to be a pointer too. Try:
#include <math.h>
#include "postgres.h"
#include "utils/palloc.h"
float *pg_sin(float *x){
float *f = (float *)palloc(sizeof(float));
*f = sin(*x);
return f;
}
Sevo
--
Sevo Stille
sevo@ip23.net