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