It seems that the stdout
that most of Julia prints to is not the same as the stdout
that C’s printf
will print to, for example:
$ julia -e 'println("before"); ccall(:printf, Cint, (Ptr{Cchar},), "hello\n"); println("after")'
before
after
hello
I came across this while debugging another issue (not sure if it’s related) and putting some printfs in my C code, and realizing that none of the C prints showed up until after the julia process exits.
- can someone give a quick run-down of the relationship between Julia’s
stdout
and whatprintf
prints to? - Is there a way to get a file descriptor for Julia’s
stdout
that I can pass into my C code to addfprintf
statements that will be visible in the normal Julia output stream?