Skip site navigation (1) Skip section navigation (2)

Linking a shared library against a C function

From: "John Gray" <jgray(at)beansindustry(dot)co(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Linking a shared library against a C function
Date: 2001-07-26 10:15:10
Message-ID: u2noj9.j5d.ln@adzuki (view raw or flat)
Thread:
Lists: pgsql-hackers
In the course of developing my XML parser hooks I've been using an
external XML parser (expat) which is built as a shared library. The 
C functions I'm writing need to access functions within that library.

Is it OK just to link the .so of my backend function against the expat
library? i.e. to do

gcc -shared -lexpat -o pgxml.so pgxml.o 

as the link stage (it seems to work fine) -or is there a portability 
problem with this?

IF this is OK, would it be sensible to change the platform-specific 
makefile %.so rule to allow the specification of extra instance specific 
flags i.e. (example from Makefile.linux)

%.so: %.o
        $(CC) -shared -o $@ $<

changed to:

%.so: %.o
	$(CC) -shared $(DLLINKFLAGS) -o $@ $< 

or something similar, which would prevent me from having to override
the global rule and allow greater portability.

Thanks

John

Responses

pgsql-hackers by date

Next:From: Turbo FredrikssonDate: 2001-07-26 10:16:52
Subject: Re: Re: plpgsql: Debug function?
Previous:From: Zudi IswantoDate: 2001-07-26 09:55:14
Subject:

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group