GMP, C++ and extern "C"

Gabriel Dos Reis gdr at integrable-solutions.net
Tue Nov 21 22:12:38 CET 2006


Jeronimo Pellegrini <pellegrini at mpcnet.com.br> writes:

| On Mon, Nov 20, 2006 at 04:23:20PM +0100, Emmanuel Thomé wrote:
| > On Mon, Nov 20, 2006 at 03:52:27PM +0100, Niels Möller wrote:
| > > 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.
| > 
| > ?
| > 
| > I don't see why you would have to to that. The 
| > 	#ifdef	__cplusplus
| > 	extern "C" {
| > 	#endif
| > 	...stuff
| > 	#ifdef  __cplusplus
| > 	}
| > 	#endif
| > works inconditionally, and allows your header to be used properly from
| > within a C++ program.
| 
| The file in question was Nettle's rsa.h, which includes gmp.h.
| 
| The problem is that I'd already do:
| 
| extern "C" {
| #include <nettle/rsa.h>
| }

But, you should not.

-- Gaby


More information about the gmp-bugs mailing list