PG Extensions: Must be statically linked?

From: "Craig A(dot) James" <cjames(at)modgraph-usa(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: PG Extensions: Must be statically linked?
Date: 2006-03-02 21:43:35
Message-ID: 44076707.8030804@modgraph-usa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm creating user-defined server extensions, written in C per the manual "31.9. C-Language Functions". Everything works well, but only if I fully link the .so such that there are *no* unresolved external references at all. Not even the stuff in libstdc++.a can be left out. I've tried setting LD_LIBRARY_PATH everywhere possible, with no luck. Here's the make(1) line I have to use to link:

libmyfuncs.so.0.0:
gcc -Wall -Wmissing-prototypes -Wpointer-arith \
-Wdeclaration-after-statement -Wold-style-definition -Wendif-labels \
-fno-strict-aliasing -fpic -shared -Wl,-soname,libmyfuncs.so.0 \
$(OBJS) \
$(MYLIB)/lib/libmylibs.a \
/usr/lib/gcc/i386-redhat-linux/3.4.2/libstdc++.a \
-o libmyfuncs.so.0.0

Is this correct? Do Postgres extension need to be fully statically linked? Or is there some configuration that will specify LD_LIBRARY_PATH (or perhaps a Postgres-specific equivalent).

The manual's instructions are good regarding writing code, but don't say much about linking.

Thanks,
Craig

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mon Nsi 2006-03-02 21:44:39 heaptuple over the network
Previous Message Bruce Momjian 2006-03-02 21:32:01 Re: [HACKERS] Spaces in psql output (Was: FW: PGBuildfarm