# Keeping Julia structure in memory between embedded function calls from C++

**URL:** <https://discourse.julialang.org/t/keeping-julia-structure-in-memory-between-embedded-function-calls-from-c/54870>\
**Category:** General Usage\
**Tags:** embedding\
**Created:** [February 8, 2021, 8:51pm UTC](https://discourse.julialang.org/t/keeping-julia-structure-in-memory-between-embedded-function-calls-from-c/54870 "2021-02-08T20:51:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuliaPerson](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@JuliaPerson](https://discourse.julialang.org/u/JuliaPerson)\
**Post date:** [February 8, 2021, 8:51pm UTC](https://discourse.julialang.org/t/keeping-julia-structure-in-memory-between-embedded-function-calls-from-c/54870/1 "2021-02-08T20:51:40Z")

</div>

So I have a Julia package. I would like to make use of the package in C++. From what I can tell from the [documentation](https://docs.julialang.org/en/v1/manual/embedding/), only arrays and scalars can be passed between the C++/Julia boundary.

In particular I’m using the [RigidBodyDynamics](https://github.com/JuliaRobotics/RigidBodyDynamics.jl). I would like to parse a URDF XML file into a Mechansim Julia structure by passing the path of the URDF XML from C++. I would then like the C++ code to subsequently make repeated calls to other embedded functions from the RigidBodyDynamics package that require a Mechanism structure to be passed as an input and updated. However I do not want to have to have to convert the Mechansim struct to a series of arrays every time when returning from Julia to C++, and I don’t want to have to convert a series of arrays into a Mechanism structure each time I call one of the embedded functions. Instead I would like to somehow keep the Julia Mechansim struct active in memory inbetween embedded calls from C++.

Is this possible? If so does anyone have recommendations as to how I might approach this?

Thanks!
