C Function Problems

From: Screech <screech(at)screech(dot)org>
To: "This is \"Need to Know\" Information": ;
Subject: C Function Problems
Date: 1998-07-20 01:24:50
Message-ID: Pine.LNX.3.96.980719200213.560Y-100000@home.screech.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)screech(dot)org
-------------------------------------------------------------------------
So many times we believe that our lives will go to waste unless strive to
achieve so many things out of haste. Sometimes we run too fast, when God
is asking us to crawl. He who is faithful minding less shall be given to
rule over all

Browse pgsql-interfaces by date

  From Date Subject
Next Message Stephan Kleinowski 1998-07-20 06:21:30 (no subject)
Previous Message Herouth Maoz 1998-07-19 10:40:00 Re: Autoincrement