cURL / Mailing Lists / curl-library / Single Mail


compiling with C++ compiler

From: Prashant R <>
Date: Thu, 3 Feb 2011 14:28:14 -0800

I know that this library was intended to compile in C however I have certain
limitations where this needs to be compiled using a C++ compiler .

I need to make some changes for these .

A lot of the changes are fixing cast incompatiblities

one such example is

new_rb = realloc(in->buffer, new_size);

where the LValue is of type X and the R Value is void * .

This compiles fine in a C compiler but is a compile error in C++ .

I am wondering if there is any harm in doing the explicit cast in code so
that C++ compilers will readily compile.

I understand that this might be a huge change for the library and if this
has been the way for historical reasons !

Other changes that I needed were

- Providing the outer structure (using scope resolution) for an enum within
a structure


http->sending == HTTPSEND_REQUEST


http->sending == HTTP::HTTPSEND_REQUEST ( or including namespace HTTP at the
top of the .c file) .

- Increment of enum types within a struct


http->sending++ seemed to be an issue .

Had to provide some special treatment to be able to get around this .

I guess I am being picky and in no way am trying to disregard the value of
this library .

I am looking for solutions for issues that I've faced and am sure other
users might have had such issues. Just wanted to know what steps they took
to be able to resolve this .


List admin:
Received on 2011-02-03