Strings can be made from functions that work with IO objects by using the sprint function. For instance, the code_llvm function accepts an IO object as the first argument. Typically, it is used like
julia> code_llvm(STDOUT, *, (Int, Int))
define i64 @"jlsys_*_46115"(i64, i64) #0 {
...