X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A09368BA08B for ; Thu, 10 Feb 2005 23:23:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10297-09 for ; Thu, 10 Feb 2005 23:22:58 +0000 (GMT) Received: from ensc.cpsc.ucalgary.ca (ensc.cpsc.ucalgary.ca [136.159.2.4]) by svr1.postgresql.org (Postfix) with ESMTP id D4FB78B9B48 for ; Thu, 10 Feb 2005 23:22:59 +0000 (GMT) Received: from imgw1.cpsc.ucalgary.ca (imgw1 [136.159.5.9]) by ensc.cpsc.ucalgary.ca (8.12.11/8.12.11) with ESMTP id j1ANJnXh015195; Thu, 10 Feb 2005 16:19:49 -0700 Received: from localhost (localhost [127.0.0.1]) by imgw1.cpsc.ucalgary.ca (8.13.3/8.12.11) with ESMTP id j1ANJmT6004479; Thu, 10 Feb 2005 16:19:48 -0700 Received: from imgw1.cpsc.ucalgary.ca ([127.0.0.1]) by localhost (imgw1 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04387-01-10; Thu, 10 Feb 2005 16:19:41 -0700 (MST) Received: from frost (frost [136.159.10.67]) by imgw1.cpsc.ucalgary.ca (8.13.3/8.13.1) with ESMTP id j1ANHBv4004264; Thu, 10 Feb 2005 16:17:11 -0700 Date: Thu, 10 Feb 2005 16:17:11 -0700 (MST) From: Seamus Thomas Carroll X-X-Sender: carrolls@frost To: Tom Lane Cc: pgsql-interfaces@postgresql.org Subject: Re: Help with adding C-Language Functions In-Reply-To: <2358.1108068219@sss.pgh.pa.us> Message-ID: References: <27779.1108056673@sss.pgh.pa.us> <2358.1108068219@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at cpsc.ucalgary.ca X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200502/42 X-Sequence-Number: 5287 Hi Tom, I am trying to LOAD the .so file and i have replaced the add_one function( this one compiled and tested after adding the extern "C"{}) with the concat_text function. It compiles but when i try the LOAD command i get the following error: ERROR: could not load library "/home/grads/.../BlackboardFunctions.so": /home/grads/.../BlackboardFunctions.so: undefined symbol: _Z16pg_detoast_datumP7varlena I am guessing this has something to do with the varlena in c.h. Seamus On Thu, 10 Feb 2005, Tom Lane wrote: > Seamus Thomas Carroll writes: >> I have c++ classes i want to use but when i complile using g++ i get the >> error (cant find function x in file.so). Does anyone have experience >> compiling c++ and loading the function? > > The immediate problem is that you didn't declare the function as extern > "C" so it doesn't follow C naming conventions. In general, though, it's > fairly difficult to use any interesting C++ capabilities in a Postgres > backend module, because the main backend does not contain the C++ > library. So, for instance, I'd not expect C++ exceptions or RTTI to > work at all well. > > regards, tom lane >