merging C/C++ code

Dieter Stüken stueken@conterra.de
Tue Feb 22 11:25:00 GMT 2005


I developed a C++ wrapper around some old C-code using:

extern "C" {
#include "eimg.h"
}

It worked great, until the developers of that C-Api meanwhile
also got same idea and included lots of "#ifdef __cplusplus"
and some wrapper classes, too. Unfortunately they are useless to
me and even quite buggy. CGG even refuses to compile them :-(

Thus I want to make those headers believe, that they are NOT
included within any C++ code, to disable all those odd extensions.

To do that I currently use something like:

extern "C" {
#undef __cplusplus
#include "eimg.h"
#define __cplusplus 199711L
}

Although it seems to work, this solution looks very odd to me.
Is there a better way to handle this? I also worry about additional
system headers which may then be included randomly within different
contexts....

Dieter.
-- 
Dieter Stüken, con terra GmbH, Münster
     stueken@conterra.de
     http://www.conterra.de/
     (0)251-7474-501



More information about the Gcc-help mailing list