Module argument to jl_new_datatype

The jl_new_datatype function appears to have gained a module argument since this commit:
https://github.com/JuliaLang/julia/commit/3c3ced4153cdc2c75319b41155c38ad1f2545fc2#diff-67021262df1246d0b5756f73b92eb69f

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.