Re: BUG #14215: External C function link failed on Mac OSX - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14215: External C function link failed on Mac OSX
Date
Msg-id 24492.1466954575@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14215: External C function link failed on Mac OSX  (max.fomitchev@gmail.com)
List pgsql-bugs
max.fomitchev@gmail.com writes:
> Linking:
> c++ -shared -o ttt.dylib main.o

This is not a PG bug. Having said that, the above is never going to
work on OS X; it has its own ideas about how to do things.  Instead
of "-shared" you need "-bundle -bundle_loader /path/to/postgres",
and there are some other linker flags that are advisable too.
Also, PG expects the file extension for loadable modules to be .so
even on OSX.

It's usually better to use PGXS to build extensions, instead of
learning such details for yourself:
https://www.postgresql.org/docs/9.5/static/extend-pgxs.html
Or you can crib from one of the extensions in the contrib/
source tree.

            regards, tom lane

pgsql-bugs by date:

Previous
From: max.fomitchev@gmail.com
Date:
Subject: BUG #14215: External C function link failed on Mac OSX
Next
From: Tom Lane
Date:
Subject: Re: BUG #14210: filter by "=" constraint doesn't work when hash index is present on a column