On 2015-11-23 22:58, Daniel Stenberg wrote:
On Mon, 23 Nov 2015, aixtools wrote:
(let's keep this in curl-library since it concerns the library)
During a build of curl-7.45 (and I expect earlier versions) - when
the target is a 32-bit build (on AIX) - sizeof(long) == 4, but on a
64-bit build sizeof(long) == 8.
(This has been the case since libcurl 7.19.0.)
The solution people have used ever since to produce headers that can
be used dynamically for either 32 bit or 64 bit builds is this:
1. generate a build for 32 bit, rename the curlbuild.h header
2. generate a build for 64 bit, rename the curlbuild.h header
3. make a custom small curlbuild.h version that checks if you build 32
bit or
64 bit and then includes the "proper" renamed version of the generated
header
4. profit!
If someone has a good idea of how to tweak libcurl to make this
process easier or more streamlined in any way, please let me know.
I have not been concerned with things like this for a long long time.
The obvious solution path, imho, would be to not make myself dependent
on the sizeof(long) - as this is variable. The struct could always be a
typedef as "long l;ong" - which at least until know has been 8 bytes in
both 32 and 64 bit. Thus might even be a union if that makes code more
readable. But rather than having a dependancy in the include file that
cannot be modified with a compiler flag (e.g., -maix64/-maix32 and/or
-q64/-q32 for the AIX compilers I know) - and, if really necessary have
something in the code that does something differently if the size of
long changes.
As I have no knowledge of "internal" knowledge of curl I have no idea
how complex or simple this may be (i.e., how often data structs
dependent on this "define" depend.), but, obviously - as is, a 32-bit
curl-linked program cannot exchange information with a 64-bit
curl-linked program - should there ever be a case where curl is the
interface sharing data in some way.
--
/ daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html