Volker Wegert wrote:
Alfonso Urdaneta <[EMAIL PROTECTED]> writes:

Works without problems, now :-)

Do you know why, or don't really care once it works ?


I don't know why, and yes, I'd like to know. :-)

Thanks in advance
  Volker


C++ allows you to create functions with the same name and different arguments. To keep them straight, the functions are internally represented as a glob of the function name the args, the phase of the moon, and your shoe size. This is called "name mangling".


C does not.

When you call a C function from a C++ program, the compiler does not know that its a C function, so if you call foo, at link time it actually looks in the symbol table for a function called foo_no_args_and_the_author_likes_cheese(). Since there is of course no function like that, because foo is a c function, you will get link errors.

By putting the "extern C" bit, you are telling the compiler to not mangle the name before it tries to find it in the symbol table and your linker errors go away.



--
alfonso e. urdaneta
www.red82.com - are you ready ?


_______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to