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
|