Static julia compilation with own package

I tried to compile Julie with my own package “FOO” with the help of script. I ran it with the following command line arguments.

julia.exe “C:/Julia-0.5.0/build_sysimg.jl” libBar core2 “C:/Julia-0.5.0/userimg.jl” --force

My userimg.jl looked like

using FOO

@Base.ccallable Float64 function jl_foo_fcn(vec1::Vector{Float64}, vec2::Vector{Float64})

	return FOO.mape(vec1, vec2)
end

@Base.ccallable Int64 function jl_foo_model(cestaT::String, cestaR::String, pathC::String)

  FOO.model(cestaT, cestaR, pathC)
  return 0
end

After compilation I can not open the final libBar.dll in C with the help of julia.h. I get error in function jl_init_with_image()

Unhandled exception at 0x0000000064F3C4BA (libjulia.dll) in TIM.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x000000FEC0D33FF8).

How correct setup commands for compilation?
If I ran Julia from folder “JULIA_HOME/bin” with command

julia.exe -J libBar.dll --compile=no --precompiled=yes

it works with functions from userimg.jl.
But, how I should compile DLL which contains my package and was executable separately?

Thanks in advance,
Martin

Please provide a minimal, complete, reproducible example. We cannot help without more information: your C code, which compiler and arguments, etc. Try building the example in examples/embedding.c, and make sure that your initialization code works on the default sysimg.

1 Like

@ihnorton I finally prepared a reproducible example on How correct open and close Julia DLL in C++?

Some of the new work described here might help, and may be worth revisiting this issue again, if still open.