Make Q's

bruce.labitt at autoliv.com bruce.labitt at autoliv.com
Fri Sep 18 16:35:11 EDT 2009


peter.dobratz at gmail.com wrote on 09/18/2009 02:52:40 PM:

> >> #ifndef UTIL_H
> >> #define UTIL_H
> >>
> >> #ifdef __cplusplus
> >> extern "C" {
> >> #endif
> >>
> >>
> >> void some_function_with_c_linkage();
> >>
> >> #ifdef __cplusplus
> >> }
> >> #endif
> >>
> >> #endif  /* UTIL_H */
> >>
> >
> > Could you explain why this is necessary, and what it does?  What is
> > necessary to use this?
> 
> "C compilers do not name mangle symbols in the way that C++ compilers 
do."
> 
> http://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%
> 2B#Linking_C_and_C.2B.2B_code
> 
> Basically, C++ supports function overloading (two functions with the
> same name that differ only in argument lists).  The actual name of the
> function that is used by the linker has an encoded version of both the
> function name and its argument types in it.  However, C does not need
> the same kind of name changing behavior because it doesn't support
> function overloading.
> 
> --Peter

Thanks everyone!  That was helpful.  Now on to debugging my python-client 
/ C++-server application.  At least the sockets parts works.  Too bad I'm 
reading the data from la-la land.  Got to fix that...

Oh yeah, and I have to go back to some of my old apps and put this in. 
Don't know why I was lucky then...

-Bruce




******************************
Neither the footer nor anything else in this E-mail is intended to or constitutes an <br>electronic signature and/or legally binding agreement in the absence of an <br>express statement or Autoliv policy and/or procedure to the contrary.<br>This E-mail and any attachments hereto are Autoliv property and may contain legally <br>privileged, confidential and/or proprietary information.<br>The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way <br>disseminating any material contained within this E-mail without prior written <br>permission from the author. If you receive this E-mail in error, please <br>immediately notify the author and delete this E-mail.  Autoliv disclaims all <br>responsibility and liability for the consequences of any person who fails to <br>abide by the terms herein. <br>
******************************



More information about the gnhlug-discuss mailing list