Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eBU2Y7L62593 for ; Fri, 29 Dec 2000 21:34:07 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBSEbxL10178 for ; Thu, 28 Dec 2000 09:37:59 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.9.3/8.9.3) id JAA79541 for pgsql-sql@postgresql.org; Thu, 28 Dec 2000 09:36:57 -0500 (EST) (envelope-from news) X-Authentication-Warning: news.tht.net: news set sender to using -f From: Ron Peterson X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Compiling "C" Functions Date: Thu, 28 Dec 2000 09:36:57 -0500 Organization: Yellowbank Lines: 33 Message-ID: <3A4B5009.9B09745D@yellowbank.com> References: <3A390BF7.71D0E481@marilia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.tht.net 978014217 79538 138.110.30.68 (28 Dec 2000 14:36:57 GMT) X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.4.0-test9 i686) X-Accept-Language: en To: pgsql-sql@postgresql.org X-Archive-Number: 200012/302 X-Sequence-Number: 640 Tulio Oliveira wrote: > > I appreciate any "C" Function complete samples, including de command > line for > the compiler. I've attached a generic GNU make snippet for compiling .so files. Adjust to suite your tastes. Like my math textbooks used to say "writing the C code is trivial, and is left as an excercise for the reader." ;) CC = /usr/bin/gcc TARGET = debug #TARGET = final DFLAGS = -Wall -g FFLAGS = -Wall -O2 SFLAGS = -fpic -shared MYINCLUDES = -I/usr/local/include -I/usr/local/src/postgresql/src/include -I/usr/local/postgresql/include MYLIBS = -L/usr/local/lib -L/usr/local/postgresql/lib -lpq ifeq ($(TARGET),final) MYCFLAGS = $(FFLAGS) else MYCFLAGS = $(DFLAGS) endif %.so: $(CC) $(MYCFLAGS) $(MYINCLUDES) $(MYLIBS) $(*F).c -c -o $(*F).o $(CC) $(SFLAGS) $(*F).o -o $(*F).so [ -d $(TARGET) ] || mkdir $(TARGET) mv $(*F).so $(TARGET) rm *.o