Make Q's

bruce.labitt at autoliv.com bruce.labitt at autoliv.com
Fri Sep 18 14:16:47 EDT 2009


gnhlug-discuss-bounces at mail.gnhlug.org wrote on 09/18/2009 12:16:15 PM:

> 
> Derek Atkins writes:
> 
> > Perhaps you need an 'extern "C"' in there so C++ knows how to call the 
C
> > functions?
> 
> To cut to the chase, Bruce probably should make sure that all of his C
> functions are declared in C-specific header files that have the
> following pattern:
> 
> 
> 
> #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?

> Bruce will also want to make sure that his C functions are compiled by
> an actual C compiler.
> 

My makefile did that.  The C files are compiled with gcc, the C++ files 
with g++.

> This advice is a little bit of my opinion and a little bit of an
> inflexible "you must do this if you want this to work".
> 

I've not seen this type of code before.  I wonder why all of my previous 
code even works.  Surely it is a way to do it.  Is there a simpler way? 
(Not that the above is hard by any means.)


Cheers,
-Bruce


> Regards,
> 
> --kevin
> 


******************************
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