help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison complains about undefined reference of my own data type


From: Laurence Finston
Subject: Re: Bison complains about undefined reference of my own data type
Date: Fri, 28 Nov 2008 17:10:27 +0100 (CET)


On Fri, 28 Nov 2008, Samuel Tardieu wrote:

> I wrote "this C++ code". It means that you must compile it with g++ (otherwise
> it is valid C code), as well as link it with g++ (without deriving too much,
> let me just say that g++ called in link mode does a bit more than linking --
> it takes care of the exceptions, constructors and destructors as well through
> another program called collect2).

Yes, I understood that.  `extern "C"' wouldn't be necessary if it were C.  
Compiling and linking worked with `g++' both ways, with or without 
declaring `exit' to have `extern "C"', whether I compiled and linked in a 
single step or separately.  

I'm sorry if I'm being obtuse.  What are you doing differently and what 
error message is one supposed to get?

> 
> | It seems to me that if a compiler doesn't mangle any "unqualified" names, 
> | i.e., ones  declared outside of a namespace or a class, it should be 
> possible to link
> | with the object file in which they are defined without the linker having to 
> | do anything special.  However, it's been a long time since I read
> | anything about this subject and this may be naive.
> 
> The linker does nothing special wrt mangled names. Only the compiler does.

Yes, that makes sense.  I hadn't thought it through.

Thanks again.

Laurence




reply via email to

[Prev in Thread] Current Thread [Next in Thread]