Issue 1:
I was being really lazy when I wrote this one-liner:

bytes2hex(arr::Vector{UInt8}) = join([hex(i,2) for i in arr])

It's a good intro issue to rewrite this to pre-allocate a byte buffer, go through and fill it with hex characters appropriately and then return that buffer wrapped in a string object.

Issue 2:
I do not manage to call Julia from a C-main program under Windows 7. I am aware of issues

#11419, #15194. I have the following C-Program testc.c to perform a minimal test (as adviced in the Julia documentation about embedding Julia). The program is stored under $JULIA_DIR\bin:

#include "julia.h"
int main(int argc, char *argv[])
{
jl_init(NULL);
jl_eval_string("display(2.0)");
jl_atexit_hook(0);
return 0;
}

All the following is performed under Windows 7 with MSYS2 and MINGW64 as adviced in https://github.com/JuliaLang/julia/blob/master/README.windows.md.

In all experiments, I start with a fresh MSYS2 shell and execute the following commands:

JULIA_DIR=<location of JULIA directory>
JULIA_HOME=$JULIA_DIR/bin
export PATH=$JULIA_DIR/bin:$PATH
export PATH=<location of MINGW installed by JULIA>/usr/x86_64-w64-mingw32/sys-root/mingw/bin:$PATH
cd $JULIA_DIR/bin

Running Julia 0.4.3 or 0.4.5 with the command:

gcc -I$JULIA_DIR/include/julia -L$JULIA_DIR/bin -L$JULIA_DIR/lib -ljulia -lopenlibm testc.c -o testc

gives the following error:

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x0 -- unknown function (ip: 0000000000000000)
unknown function (ip: 0000000000000000)

Running Julia 0.5.0-dev:

Julia Version 0.5.0-dev+4536
Commit 44d778a (2016-06-05 01:30 UTC)
Platform Info:
System: NT (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-4800MQ CPU @
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, haswell)

again with

gcc -I$JULIA_DIR/include/julia -L$JULIA_DIR/bin -L$JULIA_DIR/lib -ljulia -lopenlibm testc.c -o testc

is successful. Running the generated testc.exe gives the following error:

LLVM ERROR: Program used external function 'rint' which could not be resolved!

From #11419, libopenlibm should be statically linked (especially since rint is a symbol in libopenlibm). Trying to generate a libopenlibm.dll.a stub library for this:

dlltool -z libopenlibm.dll.def --export-all-symbol libopenlibm.dll
dlltool -d libopenlibm.dll.def -l libopenlibm.dll.a
gcc -I$JULIA_DIR/include/julia -L$JULIA_DIR/bin -L$JULIA_DIR/lib -ljulia -lopenlibm testc.c -o testc

gives error messages due to multiple defintiions of

atexit, _encode_pointer, __mingw_init_ehandler, _gnu_exception_handler

Removed these symbols in libopenlibm.dll.def and running again:

dlltool -d libopenlibm.dll.def -l libopenlibm.dll.a
gcc -I$JULIA_DIR/include/julia -L$JULIA_DIR/bin -L$JULIA_DIR/lib -ljulia -lopenlibm testc.c -o testc

This is successful. Running the generated testc.exe gives the following error:

testc.exe: error while loading shared libraries: (null): cannot open shared object file: No such file or directory

I am stuck and do not know what to else to do. Help is appreciated.