Config headers for dynamic native modules? #17286
Replies: 3 comments 2 replies
-
Natmod builds are (should be) completely separate from any particular port or port configuration. Basically the entire C API should be hidden - only a very limited set of functions are available - via the symbol table - and that is also the only ABI that is defined, afaik. |
Beta Was this translation helpful? Give feedback.
-
Re the modules being independent of any particular port: but they'll only run on the same architecture as built for, right? I thought the target arch was specified in the So if I understand, in an ideal codebase, the many header files which get recursively included by dynruntime.h would hide the elements that aren't supposed to be used in natmod builds (e.g., with a One of the ABI issues I noticed is that there is a thread mutex |
Beta Was this translation helpful? Give feedback.
-
Yes, wasn't pursuing a use case where I'd access that structure. Was just trying to compile a reference for myself of the API available to natmods. And was surprised to discover divergences like this. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been experimenting with dynamic native modules (as in the
examples/natmod
folders, building.mpy
files with native code contents). I'm puzzled by the fact that the examples, although they build and run fine, end up using different config macros than the port (Unix/standard variant) I'm loading them into. TheMICROPY_CONFIG_ROM_LEVEL
for example is different, and many other settings. Not only does this end up hiding some parts of the C API from my native module, it also changes the definitions of some structs and so changes the ABI. It's just lucky then that the examples I've built haven't crashed.I expect that a proper build process would first incorporate all the macro definitions in my
mpconfigport.mk
andmpconfigport.h
(and their includes), then overlay any changes appropriate to the dynamic module compilation. It doesn't seem that the first of these steps is handled in any of the examples.Am I understanding things right? How do others manage this?
Beta Was this translation helpful? Give feedback.
All reactions