Обсуждение: Creating a C Function

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

Creating a C Function

От
Screech
Дата:
I am trying to create a function using C, but I am having trouble getting
Postgres to execute it.  If I call the function from a C program, it works
fine, but pgsql gives me this:

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

Perhaps I am failing in the compilation/linking process.  Does anyone
happen to have a generic make file for Linux (2.0.32, pgsql v. 6.3.2)?
The file is there, and the complete tree (including the .so) is world
readable/executable.

In case it matters, here is the interface for the function:

text * gen_username (text *lname, text *fname);

Any ideas?  Thanks...

 Jason Lee                                             screech@screech.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




Re: [INTERFACES] Creating a C Function

От
"Roderick A. Anderson"
Дата:
On Fri, 3 Jul 1998, Screech wrote:

> I am trying to create a function using C, but I am having trouble getting
> Postgres to execute it.  If I call the function from a C program, it works
> fine, but pgsql gives me this:
>
> ERROR:  Load of file /usr/local/pgsql/obj/gen_username.so failed: Unable
> to resolve symbol

Is '/usr/local/pgsql/obj/' in the library path for your system?  Try
copying gen_username.so to '/lib' or '/usr/lib' (probably the second is
the best).
  This is a quick SWAG.

Rod
--
Roderick A. Anderson
raanders@altoplanos.net               Altoplanos Information Systems, Inc.
Voice: 208.765.6149                            212 S. 11th Street, Suite 5
FAX: 208.664.5299                                  Coeur d'Alene, ID 83814


Re: [INTERFACES] Creating a C Function

От
Screech
Дата:
On Sat, 4 Jul 1998, Roderick A. Anderson wrote:

> > I am trying to create a function using C, but I am having trouble getting
> > Postgres to execute it.  If I call the function from a C program, it works
> > fine, but pgsql gives me this:
> >
> > ERROR:  Load of file /usr/local/pgsql/obj/gen_username.so failed: Unable
> > to resolve symbol
>
> Is '/usr/local/pgsql/obj/' in the library path for your system?  Try
> copying gen_username.so to '/lib' or '/usr/lib' (probably the second is
> the best).
>   This is a quick SWAG.

OK.  I'm slow. :) (I haven't replied yet, have I?  Maybe I'm dumb...  :)
Lots of things going on. I put the .so in /usr/lib, ran ldconfig in case
that's necessary <shrug> to no avail.  I stole the make file from some of
the tutorial examples.  If I compile the tutorials, it works like a champ,
but mine still fails.  Is there someting special I should be doing in the
C source?  I'm sure I'm missing something minor... TIA...

 Jason Lee                                             screech@screech.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