merging C/C++ code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
    http://www.conterra.de/
    (0)251-7474-501

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux