From: Seamus Thomas Carroll <carrolls@cpsc.ucalgary.ca>
To: pgsql-interfaces@postgresql.org
Subject: Re: Help with adding C-Language Functions
Date: Thu, 10 Feb 2005 01:17:14 -0700 (MST)
Message-ID: <Pine.LNX.4.60.0502100114310.5503@frost> (raw)
In-Reply-To: <Pine.LNX.4.60.0502091954340.5503@frost>
References: <Pine.LNX.4.60.0502091954340.5503@frost>
I changed my file from BlackboardFunctions.c to all lowercase,
blackboardfunctions.c, and the database now finds the add_one function.
Crazy. Can someone explain the reason why this happened? Is this a
linker issue or something in postgresql.
Seamus
On Wed, 9 Feb 2005, Seamus Thomas Carroll wrote:
> Hi,
>
> I am trying to add a C-Language Function. I have created a small example in
> file BlackboardFunctions.c.
>
> #include <postgres.h>
> #include <fmgr.h>
>
> PG_FUNCTION_INFO_V1(add_one);
>
> Datum
> add_one(PG_FUNCTION_ARGS)
> {
> int32 arg = PG_GETARG_INT32(0);
>
> PG_RETURN_INT32(arg + 1);
> }
>
> The make file:
> make:
> cc -fpic -c BlackboardFunctions.c -I
> /home/grads/carrolls/source/postgresql-7.4.5/src/include/
> cc -shared -o BlackboardFunctions.so BlackboardFunctions.o
>
> Everything compiles nicely and when i try to add the function using:
> Blackboard=# CREATE FUNCTION add_one(integer) RETURNS integer
> Blackboard-# AS
> '/home/grads/carrolls/gradstudies/implementation/BlackboardFunctions/BlackboardFunctions',
> 'add_one'
> Blackboard-# LANGUAGE C STRICT;
>
> I get the following error:
> ERROR: could not find function "add_one" in file
> "/home/grads/carrolls/gradstudies/implementation/BlackboardFunctions/BlackboardFunctions.so"
>
> A grep of BlackboardFunction.so finds add_one.
> I figure i must be doing something obviously wrong but for the life of me i
> cant figure out what that might bt. Can anyone recommend a course of action?
>
> Thank you,
>
> Seamus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: carrolls@cpsc.ucalgary.ca
Subject: Re: Help with adding C-Language Functions
In-Reply-To: <Pine.LNX.4.60.0502100114310.5503@frost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox