FW: [Doxygen-users] RE including headerfiles inside extern "C"
Brought to you by:
dimitri
From: Catenacci, O. <Ono...@co...> - 2002-01-04 13:59:51
|
I've also seen an #ifdef __cplusplus__ used for this same purpose. The advantage of doing this in the header is that it's better information hiding. This way, your user can include your file.h without having to worry about putting the extern "C" declaration around it if it's used in C++ source. -- Onorio > -----Original Message----- > From: Clift Norris [mailto:no...@ac...] > Sent: Friday, January 04, 2002 8:44 AM > To: dox...@li... > Subject: [Doxygen-users] RE including headerfiles inside extern "C" > > > > > > You could do it this way (in the C header file): > > #ifndef __STDC__ > extern "C" > { > #endif > > // code that is "C" language only > > #ifndef __STDC__ > } // close for extern "C" > #endif > > > -Clift > > > > -----Original Message----- > From: dox...@li... > [mailto:dox...@li...]On Behalf > Of Tommy Sanddal > Poulsen > Sent: Friday, January 04, 2002 6:33 AM > To: 'dox...@li...' > Subject: [Doxygen-users] RE: including headerfiles inside extern "C" > > > The reason for not having the extern "C" declaration inside > the file.h is > that the file.h is considered a standard C header file and is > heavily used > in standard C programs on several platforms and compilers. > The problem only appears for #defines - not for e.g. typedefs etc. > -----Original Message----- > FROM: Catenacci, Onorio > DATE: 01/04/2002 03:41:10 > SUBJECT: FW: [Doxygen-users] including headerfiles inside extern "C" > Is there anything preventing you from moving the extern "C" > declaration to > the file.h file? Something like this: > > file.h: > /// MEDEF doc > extern "C" { > #define MYDEF 1 > > //etc. > > } //end extern "C" declaration > > fileA.cpp > #include "file.h" //automatically picks up extern "C" because > it's in the > header file. > > In fact I'm more accustomed to seeing the extern "C" in the > header file as > opposed to being in the files that include the header. Of course that > doesn't mean that is more correct--it's just what I'm > accustomed to seeing. > > -- > Onorio Catenacci > -----Original Message----- > From: Tommy Sanddal Poulsen [mailto:<EMAIL: PROTECTED>] > Sent: Friday, January 04, 2002 4:42 AM > To: '<EMAIL: PROTECTED>' > Subject: [Doxygen-users] including headerfiles inside extern "C" > > > > Hi, > I'm currently working on a project implemented in C++ and > having C interface > functions declared in separate h-files. The header files are > included inside > extern "C" blocks, and this results in multiple define > documentation blocks > in the doxygen documentation for the h-file. > The three files file.h, fileA.cpp and fileB.cpp documented > using a standard > doxygen config file (although EXTRACT_ALL=YES) yields the > peculiar result of > three blocks documenting the define of the headerfile - I > expected only one, > as is the result when the #include's are not embedded inside > an extern "C" > block. > Does anyone have an idea of what to do ? > file.h: > /// MEDEF doc > #define MYDEF 1 > fileA.cpp > extern "C" { > #include "file.h" > } > void fA() {} > fileB.cpp > extern "C" { > #include "file.h" > } > void fB() {} > > > - thanks > >Tommy Poulsen > > > _______________________________________________ > Doxygen-users mailing list > Dox...@li... > https://lists.sourceforge.net/lists/listinfo/doxygen-users > |