curl-library
Re: Problems with libcurl, OS X, and curl_off_t (or : What's My Size?)
Date: Mon, 16 Aug 2004 10:45:18 -0400
On 8/15/04, at 6:59 PM, Daniel Stenberg said:
>On Fri, 13 Aug 2004, Ryan Wilcox wrote:
>
>> In order to make this work I had to make the following modifications to
>> configure-mac.h (which I will verify for Codewarrior, then submit a patch in
>> the formal manner)
>
>Sorry, but I will not accept a config-*.h file for a platform on which
>configure is the prefered way.
I totally understand. Ordinarily I'd be right there with you on this one. I kind
of understand the hugeness of libcurl - supporting almost every platform known
to man, and a few dozen languages as well. Even the three platforms I support
with my product is sometimes No Fun.
Except in this mix we have Mac OS X, being a merge of the old Mac OS, and
NeXT/Unix, always has Two Ways Of Doing Things.
In this case we have the Unix Way - configure, make, make install, and the Mac
way - using IDEs like Codewarrior and now Apple's XCode IDE. From my experience,
these tend to make you ignore the Unix Way(s), and pretend you were back on OS 9
without a commandline.
This is why I needed to patch config-mac.h -- because I can't assume that
everybody is going to be using configure/make/make install. You could be using
XCode, or even Codewarrior on OS X.
My patched config-mac.h file will still work on OS 9 and/or Codewarrior for the
final version of the patch (I'd be careful not to break that), but also do a
check for GCC/XCode and turn on the appropriate switches for that IDE. Including
it in the email was just for background information (or maybe if I had missed a
dumb switch somewhere). :)
>> You'll also notice SIZEOF_CURL_OFF_T is 8. It's 8 because OS X, like a normal
>> POSIX system has curl_off_t defined as off_t. On OS X sizeof(off_t) == 8.
>>
>> Ok, that's grand. On OS X off_t seems to be a weird type. In thread entitled
>> "libcurl putting an empty file on OS X", specifically this post
>> (http://curl.haxx.se/mail/lib-2003-12/0237.html) seems to say that off_t may
>> be "oddly" defined on OS X, but that casting your postSize parameter to a
>> long solves the problem.
>
>Eh, you confuse things here. *That* problem occurred because he passed an
>off_t to a function that expected a long. Nothing else.
Ohhh... yes, I see it now. The documentation tells you what variable type an
option expects. Ok, that's cool. I'm working with Casey O'Donnell on wxCurl, so
I'll go through that and make *sure* we're using the proper types where we need
to be... ;)
I also thought that it *might* be a case of confusion... a few months ago I
played with pycurl, but this is the first time I've used libcurl in C/C++.
>> So, this morning I played around with setting curl_off_t to a long long
>> instead
>
>Isn't off_t already a long long on OS X?
No, it's an off_t. I'm 99% sure it's an off_t even using the traditional
configure/make/make install development approach, because of what the curl.h
header does (it looks for GCC running on Windows, and not the Borland compiler.
If those conditions are met then curl_off_t is a long-long. Else it assumes
normal posix and sets to an off_t.)
Thanks for the help so far, and I'd like to hear what you have to say about my
thoughts on config-mac.h and how it's still relevant for OS X development.
Thanks so much!,
_Ryan Wilcox
================================================================
Wilcox Development Solutions: http://www.wilcoxd.com
Toolsmiths for the Internet Age PGP: 0x2F4E9C31
Received on 2004-08-16