GMP, C++ and extern "C"

Niels Möller nisse at
Mon Nov 20 15:52:27 CET 2006

Emmanuel Thomé <Emmanuel.Thome at> writes:

> The ``recommended'' way of doing things is:

> 	#idef	__cplusplus
> 	extern "C" {
> 	#endif

> Modify nettle.h that way, I suspect your life will be easier.

I take it there's no chance of gmp supporting

  extern "C" {
    #include <gmp.h>


Then maybe adding C++ guards to all nettle include files is the
easiest solution, after all. Even though I really would have preferred
to let those users who actually use (and know!) C++ handle all the C++

The most time consuming part that change is not the editing of the
header files, but the introduction of a C++ test case, and the
corresponding changes to Makefiles and configure script to compile and
use the test case only if a C++ compiler is available, and sort out
which compiler is to be used for which files.


More information about the gmp-bugs mailing list