Re: function compiled with g++

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: Boris Pran <boris(dot)pran(at)finteh(dot)hr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: function compiled with g++
Date: 2001-09-24 06:03:41
Message-ID: 3BAECCBD.2D878E84@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Boris Pran 2001-09-24 06:03:45 function compiled with g++
Previous Message Sally Jo Cunningham 2001-09-24 05:58:29 request for database bug 'war stories'