-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
Initializing the Julia runtime, i.e. calling jl_init(), changes the behavior of stdio streams due to Julia's use of libuv. Some documentation is here:
https://docs.julialang.org/en/v1/devdocs/stdio/
If the C program that calls Julia also performs IO itself, e.g. with scanf and printf, how to avoid conflicts? How about C++ programs using std::iostream? Clarifying these questions would be valuable in e.g. the manual section on embedding Julia:
https://docs.julialang.org/en/v1/manual/embedding/
I previously posted on Discourse to point out bugs that can arise in a C program in the presence of such conflicts. I didn't get a complete solution, though I proposed a solution when all IO is performed with std::iostream:
https://discourse.julialang.org/t/c-program-embedding-julia-works-in-terminal-but-breaks-in-pipes/86973
P.S. For pure C programs, it seems that one solution is avoiding directly using stdio and only using jl_printf and jl_stderr_stream. This requires changing the IO code in the entire program.