mp_off_t
in dynamic native modules
#17298
Unanswered
dubiousjim
asked this question in
Core Development
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When building a dynamic native module (natmod, loadable native code in a
.mpy
file), the example make process creates a file${modulename}.config.h
output bympy_ld.py --preprocess
; this file is then included inmpconfig.h
via the macroMP_CONFIGFILE
.The
mpy_ld.py --preprocess
call always outputs the line:This is dubious for a number of reasons.
First, the system's
off_t
is a signed value, and so too when I build my port (ports/unix/variants/standard
), thempconfigport.h
file also uses a signed value (eitherlong long
orlong
). But here an unsigned value is used. This could change the semantics (though in practice it might not matter, I'd rather not blindly trust my compiler to be cooperative here).Second, although my port does check whether it's appropriate to use a
long long
, depending on the macro_FILE_OFFSET_BITS
,mpy_ld.py
does not. So it could easily happen, on a 32 bit system, that the port treatsmp_off_t
as 64 bits, but the dynamic native module treats it as 32 bits.To fix the
mpy-ld.py
issue, I'm considering adding an argument to this tool that will enable overriding the setting ofmp_off_t
. But wanted to ask about what's happening here before making the trouble (for myself and others) of a pull request.Beta Was this translation helpful? Give feedback.
All reactions