Return-Path: owner-postman
Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id EAA10115 for postgres-redist; Fri, 2 Sep 1994 04:02:54 -0700
Resent-From: POSTGRES mailing list <postman@postgres.Berkeley.EDU>
Resent-Message-Id: <199409021102.EAA10115@nobozo.CS.Berkeley.EDU>
X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: owner-postman
Received: from cs.few.eur.nl (root@kaa.cs.few.eur.nl [130.115.1.95]) by nobozo.CS.Berkeley.EDU (8.6.9/8.6.3) with SMTP id EAA10105 for <Postgres@postgres.berkeley.edu>; Fri, 2 Sep 1994 04:02:51 -0700
Received: from argon.cs.few.eur.nl by cs.few.eur.nl (5.67/EUR)
	id AA19796; Fri, 2 Sep 94 13:02:39 +0200
From: Vincent Schenkelaars <schenkel@cs.few.eur.nl>
Received: by argon.cs.few.eur.nl (5.67/EUR/BSD)
	id AA18370; Fri, 2 Sep 94 13:02:38 +0200
Date: Fri, 2 Sep 94 13:02:38 +0200
Message-Id: <9409021102.AA18370@argon.cs.few.eur.nl>
To: Postgres@postgres.Berkeley.EDU
Subject: Undefined symbol in user function
Resent-To: postgres-redist@postgres.Berkeley.EDU
Resent-Date: Fri, 02 Sep 94 04:02:54 -0700
Resent-XMts: smtp

Dear Postgres Group,


I'm using postgres 4.2 on sunos4.3.1. I'm getting a undefined symbol _sin error
when using a simple test function with postgres.

I created the database test.
my c-function is:

#include "tmp/postgres.h"
#include <math.h>

float4 *
test(f)
  float4 *f;
{
  float4 *result;

  result = (float4 *) palloc(sizeof(float4));

  *result = sin(*f);
  return (result);
}


I compiled it with
cc -I$POSTGRESHOME/include -c test.c 
ld -dc -dp -Bdynamic -o test.so test.o

and I defined the function with:
define function test (language="c", returntype = float4) as
 "/export/local/geo-geo-ext/test.so"


when I do a retrieve (t = test(1::float4)) directly in the backend I get
ld.so: Undefined symbol: _sin.


What went wrong?  Shouldn't the backend have linked the libm.a file? 
Surely it didn't do it right.  When I remove the sin function in my c-source.
everything goes fine.


Please give me some clues?

Regards,
     ____________________   Vincent F. Schenkelaars
 \  / . _   _  _   _  |	    E-mail: Schenkelaars@cs.few.eur.nl
  \/ ( ( \ (_ (-' ( \ |     
			    "We apologize for the inconvenience"

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
