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

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: How to compile, link and use a C++ extension
Дата
Msg-id CAM3SWZTOQ+fKpGumWiPV4SiTR+6YL=yWzkwAUZAkbaSpLYELzg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to compile, link and use a C++ extension  (Tom Lane <tgl@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  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
On Fri, Aug 14, 2015 at 10:28 AM, Tom Lane <tgl@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. Any use of longjmp() will cause undefined
behavior in C++. That's because each C++ object's destructor will not
be called (possibly other reasons, too).

I suggest looking at the PL/V8 code for an example of how to make C++
code work as a Postgres extension. IIRC they've made specific
trade-offs that might be useful for Jacques' use case too.

-- 
Peter Geoghegan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: why can the isolation tester handle only one waiting process?
Следующее
От: Andres Freund
Дата:
Сообщение: Re: How to compile, link and use a C++ extension