Strange behavior in module __init__

I created a simple module with just the following code:

$ cat X/src/X.jl
module X

function __init__()
    @show Ptr{UInt8}(0x123456789abcdef0)

end # module

When I run it directly from the command line, I get expected result:

$ julia X/src/X.jl
Ptr{UInt8}(0x123456789abcdef0) = Ptr{UInt8} @0x123456789abcdef0

but when I load it with “using”, I get all zeros

$ julia -e 'using X'
Ptr{UInt8}(0x123456789abcdef0) = Ptr{UInt8} @0x0000000000000000

What is happening here?

The closest thing I could find in the documentation is in,

Constants involving most Julia objects that are not produced by ccall do not need to be placed in __init__ : their definitions can be precompiled and loaded from the cached module image. This includes complicated heap-allocated objects like arrays. However, any routine that returns a raw pointer value must be called at runtime for precompilation to work (Ptr objects will turn into null pointers unless they are hidden inside an isbits object). This includes the return values of the Julia functions cfunction and pointer .

So I think that means that when a module is precompiled, any constant pointer (like the literal value in your __init__) is turned into null in the cached module image.