C Function Problems

Поиск
Список
Период
Сортировка
Искать

C Function Problems

От:
Screech <screech@screech.org>
Дата:
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-------------------------------------------------------------------------So many times we believe that our lives will go to waste unless strive toachieve so many things out of haste.  Sometimes we run too fast, when Godis asking us to crawl.  He who is faithful minding less shall be given to                              rule over all


FAQ