On Sun, Jan 8, 2017 at 6:23 AM, Kirill Müller <krlmlr...@mailbox.org> wrote: > On 08.01.2017 14:20, Clemens Ladisch wrote: >> Kirill Müller wrote: >>> On 08.01.2017 12:54, Clemens Ladisch wrote: >>>> Kirill Müller wrote: >>>>> ... there's no portable support for 64-bit integers. >>>>> I'm working around this issue by using a struct of size 8 >>>> >>>> A struct of size 8 does not behave the same as an integer type. >>>> >>> For compiling sqlite.c, I'm using a 64-bit integer type. I'm only >>> using the struct for compiling C++ modules that include sqlite.h. >> >> This means that you cannot link the C and C++ code together, because >> they use different types. > > Good point. I was planning to cross fingers that an 8-byte POD struct will > align nicely with a 64-bit integer. (Would need to take care about > endianness, too.) I'm open to alternatives. >> >>> On the C++ side I'll find a suitable way to handle the data. >> >> How exactly do you get the C++ compiler to handle an 8-byte struct the >> same as a 64-bit integer (a type which it supposedly does not have)? > > I'd use a multiprecision C++ class. My code uses 64-bit integers only for > reading and writing column data.
SQLite uses 64-bit integers all over the place internally, and it's going to expect those to behave like 64-bit integers. If you need to compile on a platform which does not support an integer-like 64-bit integer, and you can modify your code to store large integers in blobs, you might try defining the 64-bit integer type to be your largest int (presumably 32-bit) and see if that works. There will be many things which would definitely _not_ work, but as long as you don't ever present SQLite with an integer outside of the 32-bit range, it might work well enough. [YMMV, I have never tried this myself. I also suspect that you might find that 64-bit integer support is not your last problem.] -scott _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users