Re: Beginners q. on aotoconf and automake

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

 



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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux