Re: Calling C++ function

Поиск
Список
Период
Сортировка
От Richard Welty
Тема Re: Calling C++ function
Дата
Msg-id Mahogany-0.66.0-24736-20040815-163507.00@averillpark.net
обсуждение исходный текст
Ответ на Re: Calling C++ function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-interfaces
On Sun, 15 Aug 2004 14:27:38 -0400 Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Oliver Archner <oliver.archner@bitoek.uni-bayreuth.de> writes:
> > Can anyone point me to example which calls a C++ function from a dynamic
> > library ?

> It's gonna be fairly painful, since the backend is a C program not a C++
> program, and therefore it does not provide any of the infrastructure
> that C++ code is likely to expect --- no exception stack, no global
> constructors/destructors, no C++ library, etc.  I am not sure how much
> of this is practical to load after-the-fact in a dynamic library.

it can probably be pulled off. it will probably be very annoying to do.
we used to call gnu C++ from a Lucid Common Lisp environment back
at GE R&D (i was responsible for that particular integration can of
worms, it brings back painful memories, and it probably was a major
factor in my continuing dislike for C++.)

the library loads and initialization are an issue, as is figuring out the
"C Name" of the C++ functions. we used to run nm over the C++ object
files to find out what the C++ name mangler did. it was very clumsy,
and i spent a lot of time wishing for a better method.

tom's suggestion of shelling out might be a lot less painful.

richard
--
Richard Welty                                         rwelty@averillpark.net
Averill Park Networking                                         518-573-7592
    Java, PHP, PostgreSQL, Unix, Linux, IP Network Engineering, Security

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Type implemented in plpythonu crashes backend
Следующее
От: "Sam Stephens"
Дата:
Сообщение: C text to string issue