[GRASS-dev] computational geometry in C++ library

Francesco Paolo Lovergine frankie at debian.org
Fri May 5 16:29:40 EDT 2006


On Fri, May 05, 2006 at 06:17:08PM +0100, Glynn Clements wrote:
> > Calling C funcs from C++ is straight-forward. 
> > The reverse is not possible, the whole result would be a C++ prog.
> 
> It's not quite that bad. You can write C-callable wrapper functions in
> C++, e.g.:
> 
> 	extern "C" {
> 	
> 	void wrapper(void *p)
> 	{
> 		((Object *) p)->method();
> 	}
> 	
> 	}
> 
> Note that the GLU library is written in C++, but can be used from C
> programs.
> 

Oh, yes, but that's C++, isn't it? The resulting code will link C++
objects with all consequent headaches (e.g. obscure ABI changes from 
time to time) and C++ run-time on the shoulder. 
That's what I pointed with my first sentence, C code can be called 
by C++, but not viceversa.

-- 
Francesco P. Lovergine




More information about the grass-dev mailing list