# Value returned from Julia function used in C cause segfault

**URL:** <https://discourse.julialang.org/t/value-returned-from-julia-function-used-in-c-cause-segfault/45673>\
**Category:** General Usage\
**Tags:** embedding, memory-allocation, garbage-collection\
**Created:** [August 28, 2020, 10:41am UTC](https://discourse.julialang.org/t/value-returned-from-julia-function-used-in-c-cause-segfault/45673 "2020-08-28T10:41:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clonkk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/clonkk/32/20088_2.png) [@Clonkk](https://discourse.julialang.org/u/Clonkk)\
**Post date:** [August 28, 2020, 10:41am UTC](https://discourse.julialang.org/t/value-returned-from-julia-function-used-in-c-cause-segfault/45673/1 "2020-08-28T10:41:59Z")

</div>

Hello,

How to properly call a Julia function from C that returns a value(could be array, tuple, POD, string).  
When I try to do that, the program segfault during the `jl_call(...)` before I can call a jl\_gc\_push on the `jl_value_t*`returned by `jl_call`. I assume it’s an issue of garbage collection not properly handled except all the function argument are C-allocated Array (si the GC shouldn’t trigger at all).

I also have a question regarding Tuple construction.  
I read on this forum [API reference for Julia Embedding in C - #9 by yuyichao](https://discourse.julialang.org/t/api-reference-for-julia-embedding-in-c/3963/9) that there is tuple function, but can’t find any documentation on it.  
What I usually end up doing is something like this : `jl_eval_string("(a:124, b: 33.33)") `, but unless I’m mistaken, it means there was memory allocation and I have to call `jl_gc_push`.  
Is there a way to create a Tuple from an already allocated buffer ?
