These days, it seems like almost everybody uses a 64-bit machine. And so, there’s a tendency to forget that 32bit machines exist, and heck, opam-ci tests on those machines. It doesn’t really matter much for OCaml code (though sometimes it does, sure, sure) but for C code, it can matter a lot, e.g. is an int
32bit of 64bit ? In C/C++, we’re quite used to taking care about these things, and stuff like autotools automates a lot of the discovery process, so we just have to write code that’s conditionalized correctly. That works for C code, but then there’s the FFI interface code, and that can be a little trickier.
It’s not impossible to get right: just … well, in a world where we forget about 32-bit platforms, maybe we don’t think about it as much?
And so, I’m wondering how people who develop OCaml FFI code that talks to C libraries, deal with this? Do you take care to ensure that your code works on 32-bit platforms? Or is it something that just gets overlooked (and maybe it works, maybe it doesn’t) ?
ETA: full disclosure: I stumbled across this question b/c some code I wrote a while ago (cppffigen
) manifestly does the latter thing above. So I’m as culpable as anybody else.