The problematic code is this:
function create_module(name::String, parent::Module)
return Core.eval(parent, :(module $(Symbol(name)) end))
This gets called by
wrap_modules(cpp_lib) to create a Julia module for every module declared on the C++ side and compiled into the
cpp_lib. The parent module is
Main by default, so in Julia 0.7 using the generated modules would require the leading “.”.
I think @Ralph_Smith provided a viable workaround, but on further reflection I think using the following approach is better:
This approach is already supported as an alternative, but I intend to make it the only way to declare a module. That way no hacking into Julia internals is needed and everything works just like a normal Julia module. The only downside is that it’s a bit more verbose when there are multiple modules in the C++ lib, but in practice it’s often required to add some Julia code to the modules, so manually declaring the module is the only way to go anyway.