Module argument to jl_new_datatype



The jl_new_datatype function appears to have gained a module argument since this commit:

Does this module have to be the module where the type is defined? I’m asking this because in CxxWrap.jl types are added to a specific module using jl_set_const, but jl_new_datatype is called earlier, before the module exists.

CC @jameson


jl_init_types does something like that too. It’s supposed to be the new module, so that the method table and type name can set the module and compute a hash. But it’ll generally manage alright if you pass NULL and set it later.


Thanks, I found the relevant code in init.c. I should be able to mimic this, but I’ll first see if I can adapt CxxWrap to supply the module from the start, since I don’t like hacking into the internals this much.