| From: | Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)cz> |
|---|---|
| To: | mathprof(at)bigfoot(dot)com |
| Cc: | pgsql-general(at)postgreSQL(dot)org |
| Subject: | Re: [GENERAL] Linking in sin() as a C function |
| Date: | 2000-02-01 08:58:46 |
| Message-ID: | Pine.LNX.3.96.1000201094511.5443A-100000@ara.zf.jcu.cz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mon, 31 Jan 2000 mathprof(at)bigfoot(dot)com wrote:
> I tried the following, one at a time, to create sin() for PostgreSQL:
>
> CREATE FUNCTION sin(float8) RETURNS float8 AS '/usr/lib/libm.so' LANGUAGE 'c';
> CREATE FUNCTION sin(float4) RETURNS float4 AS '/usr/lib/libm.so' LANGUAGE 'c';
> CREATE FUNCTION sin(float4) RETURNS float8 AS '/usr/lib/libm.so' LANGUAGE 'c';
> CREATE FUNCTION sin(float8) RETURNS float4 AS '/usr/lib/libm.so' LANGUAGE 'c';
>
> Each of these gave different and odd results (and a 'segmentation fault'
> at one point), but none of them gave the right answer. What am I doing
> wrong?
Yes, it is probably wrong. Very offen PG's buildin functions allocate memory
for result and IMHO your trial wrong mixing pointers. See a backend/utils/atd
in PG source as example.
Karel
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Yury Don | 2000-02-01 09:08:05 | error with operator ~~ for varchar |
| Previous Message | Borek.Lupomesky | 2000-02-01 08:57:50 | Time of last UPDATE or INSERT |