Re: building a c function

From: Carsten Kropf <ckropf2(at)fh-hof(dot)de>
To: Stuart McGraw <smcg2297(at)frii(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: building a c function
Date: 2010-03-17 19:56:05
Message-ID: 354AD64D-DC10-4C01-BE8C-33A6B63BC924@fh-hof.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,
I think, what you probably want to do is something like that:
MODULE_big = my_funcs
OBJS = myfunc.o mysubs.o
PG_CONFIG=/usr/local/pgsql/bin/pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

Then you will get a shared library called "my_funcs" which includes both of your *.o s and will be deployed to postgres lib dir whenever you call "install" on the makefile.

Best regards
Carsten Kropf
Am 17.03.2010 um 19:27 schrieb Stuart McGraw:

> Hello all,
>
> I know this is a very elementary question, but my excuse
> is I have not programmed in C or written makefiles for
> 15+ years...
>
> I am trying to write a C-language function, call it my_func.
> But I also have a my_subs.o that does the heavy lifting
> for my_func.c. My makefile is:
>
> MODULES = my_func
> PG_CONFIG = pg_config
> PGXS := $(shell $(PG_CONFIG) --pgxs)
> include $(PGXS)
> OBJS = my_subs.o # Is this right?
>
> But I see no indication in the output that my_subs.o is
> being used:
>
> gcc -O2 -g ... -fpic -shared -o my_func.so my_func.o
>
> How do I tell the makefile to include my_subs.o when building
> the shared lib?
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2010-03-17 20:20:35 Re: update ... set ... subquery
Previous Message Szymon Guz 2010-03-17 19:52:06 Re: update ... set ... subquery