autoconf
[Top][All Lists]
Advanced

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

Re: Beginners q. on aotoconf and automake


From: Ralf Wildenhues
Subject: Re: Beginners q. on aotoconf and automake
Date: Tue, 2 Aug 2005 10:30:04 +0200
User-agent: Mutt/1.4.1i

Hi Tommy,

* Tommy Nordgren wrote on Fri, Jul 22, 2005 at 08:37:20PM CEST:
> I am trying co set up an open source library based on the GNU  
> Autotools, so it will build a C++ version of the
> library as well.

This sounds like a rather bad idea.  Why do you want to do it?
You can call your C library functions from C++ code.

> I wonder what is necessary to do to support this. My  
> C++ files are defined like this:
> //File test.cp
> #define LIB_COMPILE_AS_CPLUSPLUS
> #include "test.c"
> 
> Then in the headers I changed the following:
> 
> #ifdef __cpluplus
> #define BEGIN_DECLS extern "C" {
> #define END_DECLS }
> #else
> 
> To this:
> #ifdef __cpluplus
> # ifdef LIB_COMPILE_AS_CPLUSPLUS
> #  define BEGIN_DECLS
> #  define END_DECLS
> # else
> #  define BEGIN_DECLS extern "C" {
> #  define END_DECLS }
> # endif
> #else

If you need C++ functions to make use of some C++ features, it is
generally advisable to write (a) wrapper class(es) to encapsulate
the C functions, if possible.

> Now I wan't to do necessary modifications to the build
> infrastrucuture to support this.  I obviously need to modify
> configure.ac and the several instances of  Makefile.am to do this.  By
> the way, the library I'm trying to build this way is the GSL
> numerical library.

If you write a C++ wrapper for it (given that none exists already, be
sure to check!), the GSL people would probably be happy to include it
in their software distribution.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]