Re: [HACKERS] How to compile, link and use a C++ extension

2015-08-18 Thread Craig Ringer
On 15 August 2015 at 00:51, Andres Freund and...@anarazel.de wrote: I started my tests by cloning the contrib/worker_spi code, and when transforming the code into C++, I could only note that C++ is not supported in the provided Makefiles. Yes, that doesn't surprise me. Postgres itself

[HACKERS] How to compile, link and use a C++ extension

2015-08-14 Thread jacques klein
Hello, I want to write a BackgroundWorker in C++ (have lots of C++ code and libs to reuse). I found35.9.13 Using C++ for Extensibility in the 9.3/4 documentation who says it's possible and gives some guidelines for source-code writing. Compiling is not too difficult if one understands

Re: [HACKERS] How to compile, link and use a C++ extension

2015-08-14 Thread Tom Lane
Andres Freund and...@anarazel.de writes: On 2015-08-14 18:38:36 +0200, jacques klein wrote: However I coudn't find any doc. about how to solve the problem of linking C++ code and libs into the .so of my extension, and nothing to solve the runtime-loading problem of the c++ specific .so files

Re: [HACKERS] How to compile, link and use a C++ extension

2015-08-14 Thread Andres Freund
On 2015-08-14 11:10:14 -0700, Peter Geoghegan wrote: On Fri, Aug 14, 2015 at 10:28 AM, Tom Lane t...@sss.pgh.pa.us wrote: Yeah. The painful issues you're going to face are not that. They are memory management (C++ new does not talk to palloc or vice versa) and error handling (throw does

Re: [HACKERS] How to compile, link and use a C++ extension

2015-08-14 Thread Andres Freund
Hi, On 2015-08-14 18:38:36 +0200, jacques klein wrote: However I coudn't find any doc. about how to solve the problem of linking C++ code and libs into the .so of my extension, and nothing to solve the runtime-loading problem of the c++ specific .so files ( for ex. to make work a simple usage

Re: [HACKERS] How to compile, link and use a C++ extension

2015-08-14 Thread Peter Geoghegan
On Fri, Aug 14, 2015 at 10:28 AM, Tom Lane t...@sss.pgh.pa.us wrote: Yeah. The painful issues you're going to face are not that. They are memory management (C++ new does not talk to palloc or vice versa) and error handling (throw does not interoperate with PG_TRY()). It's worse than that.

Re: [HACKERS] How to compile, link and use a C++ extension

2015-08-14 Thread Andrew Dunstan
On 08/14/2015 02:10 PM, Peter Geoghegan wrote: On Fri, Aug 14, 2015 at 10:28 AM, Tom Lane t...@sss.pgh.pa.us wrote: Yeah. The painful issues you're going to face are not that. They are memory management (C++ new does not talk to palloc or vice versa) and error handling (throw does not