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: Tommy Nordgren
Subject: Re: Beginners q. on aotoconf and automake
Date: Tue, 2 Aug 2005 12:33:40 +0200


Aug 2, 2005 kl. 10:30 AM skrev Ralf Wildenhues:

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.


The main reason to do this, is to allow error handlers to throw exceptions, thus
simplifying error handling in multithreaded calculations.

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
address@hidden
http://lists.gnu.org/mailman/listinfo/autoconf


"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"





reply via email to

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