[pacman-dev] macros needed when using libalpm

jjacky i.am.jack.mail at gmail.com
Wed Feb 15 08:30:23 EST 2012


Hi,

Just a quick question, it might be pretty obvious but I'm still
relatively new at this, so excuse my "noobness."

While working on a little app using libalpm, I wanted to use the
download callback. But I had a problem, because the total size would
always be zero. I didn't understand why it didn't work, especially since
it did for pacman, which seemed to do exactly the same as I did.

After investigation, I figured out that this was because I needed to use
a macro when compiling, namely:
#define _FILE_OFFSET_BITS 64

Apparently one of the things this does is turn off_t (type of both size
parameters of the dl callback, among other things) into off64_t. I'm
guessing that means one more byte to store the data, and therefore
explains why with my "regular" off_t I didn't get the correct values.

Thing is, I'm not sure how I was supposed to know that using this macro
was required of me in order to get things to work properly, so my
questions are:

- how was I supposed to know? :) As in, is there any indication or
something about this written somewhere that I missed? I did look at the
README and such, but couldn't find anything. (and if not, shouldn't
there be, maybe?)
Or is this just usual/common knowledge or something?

- any chance there is/are other such things I need to use for things to
work properly? I'm guessing not, but just in case...

Thanks,
-jacky


More information about the pacman-dev mailing list