diff --git a/ports/unix/modffi.c b/ports/unix/modffi.c index ec252ef33e..b692af4df1 100644 --- a/ports/unix/modffi.c +++ b/ports/unix/modffi.c @@ -631,3 +631,5 @@ const mp_obj_module_t mp_module_ffi = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_ffi_globals, }; + +MP_REGISTER_MODULE(MP_QSTR_ffi, mp_module_ffi, MICROPY_PY_FFI); diff --git a/ports/unix/modjni.c b/ports/unix/modjni.c index 4b95a0c67d..5d2beaa8dc 100644 --- a/ports/unix/modjni.c +++ b/ports/unix/modjni.c @@ -712,3 +712,5 @@ const mp_obj_module_t mp_module_jni = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_jni_globals, }; + +MP_REGISTER_MODULE(MP_QSTR_jni, mp_module_jni, MICROPY_PY_JNI); diff --git a/ports/unix/modtermios.c b/ports/unix/modtermios.c index 7a578becb9..cce8c28ab3 100644 --- a/ports/unix/modtermios.c +++ b/ports/unix/modtermios.c @@ -148,3 +148,5 @@ const mp_obj_module_t mp_module_termios = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_termios_globals, }; + +MP_REGISTER_MODULE(MP_QSTR_termios, mp_module_termios, MICROPY_PY_TERMIOS); diff --git a/ports/unix/modtime.c b/ports/unix/modtime.c index 71257c15ff..00b3f94367 100644 --- a/ports/unix/modtime.c +++ b/ports/unix/modtime.c @@ -232,4 +232,6 @@ const mp_obj_module_t mp_module_time = { .globals = (mp_obj_dict_t *)&mp_module_time_globals, }; +MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_time, MICROPY_PY_UTIME); + #endif // MICROPY_PY_UTIME diff --git a/ports/unix/moduselect.c b/ports/unix/moduselect.c index c88eb25edb..d3e0eff038 100644 --- a/ports/unix/moduselect.c +++ b/ports/unix/moduselect.c @@ -351,4 +351,6 @@ const mp_obj_module_t mp_module_uselect = { .globals = (mp_obj_dict_t *)&mp_module_select_globals, }; +MP_REGISTER_MODULE(MP_QSTR_uselect, mp_module_uselect, MICROPY_PY_USELECT_POSIX); + #endif // MICROPY_PY_USELECT_POSIX diff --git a/ports/unix/modusocket.c b/ports/unix/modusocket.c index 5edff740f2..7526d9679d 100644 --- a/ports/unix/modusocket.c +++ b/ports/unix/modusocket.c @@ -701,3 +701,5 @@ const mp_obj_module_t mp_module_socket = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&mp_module_socket_globals, }; + +MP_REGISTER_MODULE(MP_QSTR_usocket, mp_module_socket, MICROPY_PY_SOCKET); diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index ef7c820e7e..524b165231 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -219,52 +219,6 @@ extern const struct _mp_print_t mp_stderr_print; #define mp_type_fileio mp_type_vfs_posix_fileio #define mp_type_textio mp_type_vfs_posix_textio -extern const struct _mp_obj_module_t mp_module_uselect; -extern const struct _mp_obj_module_t mp_module_time; -extern const struct _mp_obj_module_t mp_module_termios; -extern const struct _mp_obj_module_t mp_module_socket; -extern const struct _mp_obj_module_t mp_module_ffi; -extern const struct _mp_obj_module_t mp_module_jni; - -#if MICROPY_PY_FFI -#define MICROPY_PY_FFI_DEF { MP_ROM_QSTR(MP_QSTR_ffi), MP_ROM_PTR(&mp_module_ffi) }, -#else -#define MICROPY_PY_FFI_DEF -#endif -#if MICROPY_PY_JNI -#define MICROPY_PY_JNI_DEF { MP_ROM_QSTR(MP_QSTR_jni), MP_ROM_PTR(&mp_module_jni) }, -#else -#define MICROPY_PY_JNI_DEF -#endif -#if MICROPY_PY_UTIME -#define MICROPY_PY_UTIME_DEF { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) }, -#else -#define MICROPY_PY_UTIME_DEF -#endif -#if MICROPY_PY_TERMIOS -#define MICROPY_PY_TERMIOS_DEF { MP_ROM_QSTR(MP_QSTR_termios), MP_ROM_PTR(&mp_module_termios) }, -#else -#define MICROPY_PY_TERMIOS_DEF -#endif -#if MICROPY_PY_SOCKET -#define MICROPY_PY_SOCKET_DEF { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_socket) }, -#else -#define MICROPY_PY_SOCKET_DEF -#endif -#if MICROPY_PY_USELECT_POSIX -#define MICROPY_PY_USELECT_DEF { MP_ROM_QSTR(MP_QSTR_uselect), MP_ROM_PTR(&mp_module_uselect) }, -#else -#define MICROPY_PY_USELECT_DEF -#endif - -#define MICROPY_PORT_BUILTIN_MODULES \ - MICROPY_PY_FFI_DEF \ - MICROPY_PY_JNI_DEF \ - MICROPY_PY_UTIME_DEF \ - MICROPY_PY_SOCKET_DEF \ - MICROPY_PY_USELECT_DEF \ - MICROPY_PY_TERMIOS_DEF \ - // type definitions for the specific machine // For size_t and ssize_t diff --git a/ports/windows/mpconfigport.h b/ports/windows/mpconfigport.h index 1d78f00320..ecaa520e81 100644 --- a/ports/windows/mpconfigport.h +++ b/ports/windows/mpconfigport.h @@ -215,10 +215,6 @@ typedef long mp_off_t; #define MICROPY_PORT_BUILTINS \ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, -extern const struct _mp_obj_module_t mp_module_time; -#define MICROPY_PORT_BUILTIN_MODULES \ - { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) }, \ - #if MICROPY_USE_READLINE == 1 #define MICROPY_PORT_ROOT_POINTERS \ char *readline_hist[50];