# Calling embedding api from within a ccall originating from Julia

**URL:** <https://discourse.julialang.org/t/calling-embedding-api-from-within-a-ccall-originating-from-julia/71834>\
**Category:** General Usage\
**Tags:** question\
**Created:** [November 20, 2021, 4:00pm UTC](https://discourse.julialang.org/t/calling-embedding-api-from-within-a-ccall-originating-from-julia/71834 "2021-11-20T16:00:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jordanmb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jordanmb/32/30976_2.png) [@jordanmb](https://discourse.julialang.org/u/jordanmb)\
**Post date:** [November 20, 2021, 4:00pm UTC](https://discourse.julialang.org/t/calling-embedding-api-from-within-a-ccall-originating-from-julia/71834/1 "2021-11-20T16:00:28Z")

</div>

I’m attempting to integrate Julia into an existing Rust system. The julia embedding api works great when I have a rust executable calling into it, but if I try to call the same code from within a julia notebook it will segfault. Is this unsupported or is there something that I am missing in how julia is constructed? Thanks!

```julia
#[no_mangle]
pub unsafe extern "C" fn bootstrap() {
  if jl_is_initialized() == 0 {
    jl_init()
  }

  let cmd = CString::new("println(123)").unwrap();
  jl_eval_string(cmd.as_ptr()); // segfaults iff ccall from julia
}

```
