How to compile, link and use a C++ extension

From: jacques klein <jacques(dot)klei(at)googlemail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: How to compile, link and use a C++ extension
Date: 2015-08-14 16:38:36
Message-ID: 55CE198C.3060203@googlemail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, I want to write a "BackgroundWorker" in C++ (have lots of C++
code and libs to reuse).

I found " 35.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 this chapter.

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 std::string )

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.

I also found some rather old (2008) message in this mailing list which
addresses the same subject:
http://www.postgresql.org/message-id/4938E5ED.60102@acm.org:
Mostly Harmless: Welcoming our C++ friends
with patches that didn't reach their way into the source-distrib , I guess.

Is there something more actual about this subject that could help ?.

Jacques K.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-08-14 16:42:22 Re: Configure checks and optimizations/crc32 tests
Previous Message Andres Freund 2015-08-14 16:27:42 Re: Configure checks and optimizations/crc32 tests