Re: Pro-C with C++ - HELP

From: Joe Halpin <jhalpin_at_netcom.com>
Date: Sat, 20 Aug 1994 19:33:41 GMT
Message-ID: <jhalpinCuuMC6.LBw_at_netcom.com>


In article <333gur$3hs_at_openwx.networx.com> yyulaev_at_networx.com (Yuri Yulaev) writes:
> I am having problems with using C++ with ORA 7.0:
> IN PROC/demo directory if I change from CC=cc to CC=CC
> (our C++ compiler) I am getting error messages from linker,
> like simbols undefined, and these symbols are from ORACLE libraries.
> When I am trying to put more libraries in linker path, I am
> getting another undefined symbols, and so on...
> Looks like I have some general problem ....
>

If you need to declare functions which were written and compiled in C, in a C++ program, you have to use external linkage for the decarations of those functions. When you declare the header files which prototype the PRO*C routines, do it like this

extern "C" {
#include "whatever.h"
#include "whatever_else.h"

}

The reason for this is that C++ alters the names of functions in order to encode the paramter list and other things (this is called name mangling). If you let the compiler do this to names that were compiled in C (which doesn't do this kind of thing), there will be a disconnect between what you call and what's in the library.

I didn't get enough info from your post to know if this is really the problem or not, but it's a good guess :-).

-- 
Joe Halpin 
jhalpin_at_netcom.com
---------------------------------------------------------------------------
Received on Sat Aug 20 1994 - 21:33:41 CEST

Original text of this message