Strange problem with Julia embedding

Well, I write this code to display varialbe during output rediraction

    jl_value_t *out_stream = static_cast<jl_value_t *>(jl_eval_string("STDOUT"));
    jl_function_t *text_display = jl_get_function(jl_base_module, "TextDisplay");
    jl_value_t *out_display = jl_call1(text_display, out_stream);
    jl_function_t *display = jl_get_function(jl_base_module, "display");
    jl_call2(display, out_display, val);

But out_display is null and jl_call2 fails with segfault.
But this code work and does the same:

    jl_value_t *out_display = static_cast<jl_value_t *>(jl_eval_string("TextDisplay(STDOUT)"));
    jl_function_t *display = jl_get_function(jl_base_module, "display");
    jl_call2(display, out_display, val);

Is it normal? As I understand, three lines of first code does the same, that first line of second code.

Did you push out_stream, out_display, etc on to GC stack to avoid them being garbage collected?

  jl_value_t* value_jl = nullptr;
  jl_value_t* out_stream = nullptr;
  jl_value_t* out_display = nullptr;
  JL_GC_PUSH3(&out_stream, &out_display, &value_jl);
  value_jl = jl_box_float64(1.0);
  out_stream = static_cast<jl_value_t *>(jl_eval_string("STDOUT"));
  jl_function_t *text_display = jl_get_function(jl_base_module, "TextDisplay");
  out_display = jl_call1(text_display, out_stream);
  jl_function_t *display = jl_get_function(jl_base_module, "display");
  jl_call2(display, out_display, value_jl);
  JL_GC_POP();

The code above worked for me.

Well, sorry, but I forget to mention, that I use 0.4.7 Julia.
And this code don’t work for me: out_display is nullptr and julia produce segfault.
So, I think, that this maybe old julia bug, that was fixed in modern versions.

I have tested your code on 0.6.3, it’s works.
Thanks for answer!