Re: How to compile, link and use a C++ extension
От | Tom Lane |
---|---|
Тема | Re: How to compile, link and use a C++ extension |
Дата | |
Msg-id | 6731.1439573319@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: How to compile, link and use a C++ extension (Andres Freund <andres@anarazel.de>) |
Ответы |
Re: How to compile, link and use a C++ extension
|
Список | pgsql-hackers |
Andres Freund <andres@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 ( for ex. to make work a simple usage std::string ) > libstdc++ (or whatever your platform uses) should be automatically > loaded, I don't think you'll need to worry about that. 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()). If you can build a bulletproof interface layer between your C++ code and the surrounding C-coded backend, you can make it work, but that part won't be any fun. There's way too much temptation to just call assorted C-coded functions from your C++, and *that won't work* with any reliability. There are discussions of these issues in the pgsql-hackers archives. regards, tom lane
В списке pgsql-hackers по дате отправления: