I have a small piece of code which works perfectly when run as julia tmp.jl and even as julia -e 'include("tmp.jl")', but not when I start julia and immediately type include("tmp.jl")! Neither it works if I just copy-paste the content of tmp.jl into fresh julia session.
Namely, it fails with ERROR: LoadError: StackOverflowError: without traceback. So I have no idea how to debug it further from the julia side.
The code uses ccall and @cfunction with $closures to call a C/Fortran library, so I inserted a bunch of prints there for debug. They indicate that the library fails to call a function passed from julia as @cfunction, and again not sure how to debug further.
Unfortunately, I cannot provide a simple self-contained example now, as it uses both julia and c/fortran libraries.