C Function Problems - Mailing list pgsql-interfaces

From Screech
Subject C Function Problems
Date
Msg-id Pine.LNX.3.96.980719200213.560Y-100000@home.screech.org
Whole thread Raw
List pgsql-interfaces
I've managed to track down what I think is the source of this error (which
I've posted about a couple of times):

CREATE FUNCTION gen_username (char16, char16) RETURNS char16 AS '/usr/local/src/gen_username/test.so' LANGUAGE 'c';
CREATE

insert into auth_table values  (gen_username ('Smith', 'Joe'), 'John Smith');

ERROR:  Load of file /usr/local/src/gen_username/test.so failed: Unable to
resolve symbol

If I remove all of my code, and simply return the char16 the system is
expecting, the code compiles and loads correctly.  This indicates that my
linking procedures are correct.  The code that seems to kill the loading
(I added bits and pieces until the load failed) is the snippet that
connects to the DB:

... PGconn *connection;
 connection = PQsetdb ("localhost", "", "", "", "screech");
...

This code causes it to fail every time.  My question is this:  is it
permissible to connect to the DB in such manner from a function that will
be loaded?  If not, how does one accomplish such a feat (is it possible)?
The function needs to check to see if a string exists in a table before it
returns its results.  TIA...
Jason Lee
screech@screech.org-------------------------------------------------------------------------Somany times we believe
thatour lives will go to waste unless strive toachieve so many things out of haste.  Sometimes we run too fast, when
Godisasking us to crawl.  He who is faithful minding less shall be given to                              rule over all
 



pgsql-interfaces by date:

Previous
From: Oliver George
Date:
Subject: Delphi 3, PostgreSQL and PostODBC.
Next
From: Stephan Kleinowski
Date:
Subject: (no subject)