# Calling my own Julia module from C

**URL:** https://discourse.julialang.org/t/calling-my-own-julia-module-from-c/23779
**Category:** New to Julia
**Created:** [May 2, 2019, 2:15pm UTC](https://discourse.julialang.org/t/calling-my-own-julia-module-from-c/23779 "2019-05-02T14:15:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Josiah\_Slack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josiah_slack/32/8319_2.png) [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)
#### Post date: [May 2, 2019, 2:15pm UTC](https://discourse.julialang.org/t/calling-my-own-julia-module-from-c/23779/1 "2019-05-02T14:15:30Z")

</div>

I’ve read through the “Embedding Julia” section in the documentation, and have been able to call Base package functions from C. I have some local packages that I would like to access, and haven’t found any up-to-date examples of how to do this. I’d be grateful for any pointers.

---

<div class="post-metadata">

### Author: ![Pbellive](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbellive/32/3604_2.png) [@Pbellive](https://discourse.julialang.org/u/Pbellive)
#### Post date: [May 6, 2019, 9:49pm UTC](https://discourse.julialang.org/t/calling-my-own-julia-module-from-c/23779/2 "2019-05-06T21:49:41Z")

</div>

I don’t have too much experience with this but I’ve gotten it to work. I found [this thread](https://discourse.julialang.org/t/calling-jl-gc-push1-multiple-times/18666) very helpful. The thread is about dealing with garbage collection when calling julia from C but the first post has a good example of loading a module from C (C++ actually but I think everything there works in C) and then calling a function from that module. I’ve used that approach to call my own modules from C. As far as I can tell loading modules is not in the embedding documentation though so I’m not sure if there’s a more direct way to go about it.

---

<div class="post-metadata">

### Author: ![Josiah\_Slack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josiah_slack/32/8319_2.png) [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)
#### Post date: [May 6, 2019, 11:15pm UTC](https://discourse.julialang.org/t/calling-my-own-julia-module-from-c/23779/3 "2019-05-06T23:15:35Z")

</div>

Thank you! This looks promising. The multiple calls to `jl_eval_string()` in quick succession wouldn’t have occurred to me. It looks as though the first call is used for its side effects.
