I have two modules that are included by a julia program.  Let's call them 
Primary and External.

Primary contains a list of names in an array that's global to the module 
and a method to register new names:

module Primary

global names = AbstractString[]

function registerName(name::AbstractString)
    push!(names, name)
end

end

External needs to register a name into Primary, and does that in its 
initialization code:

module External

using Primary

Primary.registerName("external")

end

This works.  If I load both modules into my program or the REPL, 
Primary.names contains "external"

However, if I add __precompile__(true) to the top of Primary, this no 
longer works.  Primary.names is now always an empty array.  However, I can 
still call Primary.registerName from the REPL or my program and it works.

Is there any way for me to get Primary.registerName to work when called 
from a second module?

Reply via email to