This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: undefined symbol
- To: Puneet Singhal <puneet at opussoft dot com>
- Subject: Re: undefined symbol
- From: Vu Pham <vu at sivell dot com>
- Date: Wed, 23 May 2001 07:19:39 -0500
- CC: gcc-help at gcc dot gnu dot org <gcc-help at gcc dot gnu dot org>
- References: <NEBBJEIPELDNPPCBOLOPCEKFCEAA.puneet@opussoft.com>
Puneet Singhal wrote:
>
> Hi all
>
> I have a typical UNDEFINED SYMBOL prob over here. Here is the situation:
>
> 1. I have a cpp proggy calling a function not defined locally called
> connect_oracle.
> 2. When I do nm of the .o file of this .cpp file, the name of the symbol I
> get is
> connect_oracle__Fv and not connect_oracle.
> 3. This fn is defined in a library made of c sources. When I do nm of this
> lib
> the symbol is defined as connect_oracle.
> 4. Even though I give the full path of this library at the time of linking,
> the linker does not
> resolve this symbol from the library.
>
> I cannot understand this behavior of the linker.
>
> Any pointers
I think the reason is of "name mangling" in C++. IMHO, You can fix by
having the following declaration:
extern "C" your-function-declaration;
in your cpp file.
For example:
extern "C" connect_oracle( char * server, char *db , char * user, char
*passwd );
Hope this helps,
Vu
--
Solaris-x86 8 @ Home