W3C libwww C Style

Calling libwww from C++

Even though libwww is written in C, all public functions and data objects in libwww can be called from any C++ program as they are all declared as having C linkage and defined as separately compiled translation unit. An include file can be made to have C linkage by adding the following declaration:

	#ifdef __cplusplus
	extern "C" {		/* Start extern C declarations */
	#endif

	Declarations...

	#ifdef __cplusplus
	} 			/* End extern C declarations */
	#endif

All the Library interface include files (called WWW*.h) have the extern "C" declaration, so by using these include files your application should with no modification be able to call libwww public functions directly.


Henrik Frystyk Nielsen, libwww@w3.org

@(#) $Id: CallingLibwww.html,v 1.4 1996/12/09 03:23:02 jigsaw Exp $