Re: Phix: cffi.e
- Posted by petelomax 5 days ago
- 225 views
andreasWagner said...
only for windows 32bit but it works
They are rare, but I've seen a couple of places where this bites, for instance libcurl.e has this:
if xcurl_easy_setopt=NULL then xcurl_easy_setopt = define_c_func(libcurl, "curl_easy_setopt", {C_PTR, C_INT, C_PTR}, C_INT) if machine_bits()=32 then -- split a curl_off_t (64 bit int) into two 32-bit ints xcurl_easy_setopt2 = define_c_func(libcurl, "curl_easy_setopt", {C_PTR, C_INT, C_PTR, C_PTR}, C_INT) end if end if ... if machine_bits()=32 and option>30000 then atom paramhi = floor(param/#1_0000_0000) param = remainder(param,#1_0000_0000) res = c_func(xcurl_easy_setopt2, {curl, option, param, paramhi}) else res = c_func(xcurl_easy_setopt, {curl, option, param}) end if
It may be that you need to ram two floats into a 64-bit value the hard way, ie faff about with poke(atom_to_float32()) and peek8(), on 64-bit.