Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHBuQ-0001MF-Q7 for pgsql-bugs@arkaria.postgresql.org; Sun, 26 Jun 2016 15:23:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bHBuP-0002gE-PY for pgsql-bugs@arkaria.postgresql.org; Sun, 26 Jun 2016 15:23:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bHBtl-0001yy-UR for pgsql-bugs@postgresql.org; Sun, 26 Jun 2016 15:23:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bHBti-00052K-QU for pgsql-bugs@postgresql.org; Sun, 26 Jun 2016 15:23:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u5QFMt81024493; Sun, 26 Jun 2016 11:22:55 -0400 From: Tom Lane To: max.fomitchev@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14215: External C function link failed on Mac OSX In-reply-to: <20160626092721.17236.73734@wrigleys.postgresql.org> References: <20160626092721.17236.73734@wrigleys.postgresql.org> Comments: In-reply-to max.fomitchev@gmail.com message dated "Sun, 26 Jun 2016 09:27:21 -0000" Date: Sun, 26 Jun 2016 11:22:55 -0400 Message-ID: <24492.1466954575@sss.pgh.pa.us> X-Pg-Spam-Score: -2.9 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs