Re: function compiled with g++ - Mailing list pgsql-general

From Thomas Lockhart
Subject Re: function compiled with g++
Date
Msg-id 3BAECCBD.2D878E84@fourpalms.org
Whole thread Raw
In response to function compiled with g++  (Boris Pran <boris.pran@finteh.hr>)
List pgsql-general
> Why the same function writen in C, compiled with gcc works OK, but compiled
> with g++, doesn't even load? Not mentioning those written in C++.
> i.e. loader reports undefined symbol: pg_detoast_datum__FP7varlena or some
> other undefined symbol...

C++ compilers do "name mangling" to allow function overloading. If you
are going to call a C++ routine from C or most other languages, you need
to wrap the declaration for the called function in the following:

  extern "C" {
    retval your_function_here(arg1,arg2);
  }

hth

                       - Thomas

pgsql-general by date:

Previous
From: Boris Pran
Date:
Subject: function compiled with g++
Next
From: Jeff Davis
Date:
Subject: Re: function compiled with g++