# Embedding non-Base-Module Julia function in C

**URL:** https://discourse.julialang.org/t/embedding-non-base-module-julia-function-in-c/8449
**Category:** General Usage
**Tags:** embedding
**Created:** [January 18, 2018, 3:51am UTC](https://discourse.julialang.org/t/embedding-non-base-module-julia-function-in-c/8449 "2018-01-18T03:51:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![standarddeviant](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/standarddeviant/32/2309_2.png) [@standarddeviant](https://discourse.julialang.org/u/standarddeviant)
#### Post date: [January 18, 2018, 3:51am UTC](https://discourse.julialang.org/t/embedding-non-base-module-julia-function-in-c/8449/1 "2018-01-18T03:51:28Z")

</div>

The docs (as of 0.6) are pretty clear how to embed a julia function from the Base module:  
[https://docs.julialang.org/en/release-0.6/manual/embedding/](https://docs.julialang.org/en/release-0.6/manual/embedding/)

I see that there are some convenience options for `Base` and `Main`, but what about custom modules?

How can I call a function that is from a custom module? Do I need to resolve the module in C based on the string name?

---

<div class="post-metadata">

### Author: ![nextr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nextr/32/3131_2.png) [@nextr](https://discourse.julialang.org/u/nextr)
#### Post date: [January 22, 2018, 9:04am UTC](https://discourse.julialang.org/t/embedding-non-base-module-julia-function-in-c/8449/2 "2018-01-22T09:04:29Z")

</div>

Hi standarddeviant,

I opened a similar topic a few days ago. I doesn’t seem trivial, but there are some information here :

> [@How to use a julia compiled object from within a C program](https://discourse.julialang.org/t/how-to-use-a-julia-compiled-object-from-within-a-c-program/8475):
>
> Hi all ! I need to develop an interface to use an existing Julia project from within a C porgram. As I am VERY newbie in Julia, I started creating a VERY simple Julia script to better understand the operation mode. The steps I need to achieve are (I guess) : Write a simple julia script Create an object (using output-o compilation option) Create a shared object (by gcc -share) Create a .h header to use this library from C Use the Julia library from C But I am experiencing problems with the …

Hope it could help.

Nextor

---

<div class="post-metadata">

### Author: ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)
#### Post date: [January 22, 2018, 12:28pm UTC](https://discourse.julialang.org/t/embedding-non-base-module-julia-function-in-c/8449/3 "2018-01-22T12:28:39Z")

</div>

The two questions are unrelated.

And there’s no difference between `Base` and custom functions. Yes, you just need to evaluate the right string to get the reference to your module.

---

<div class="post-metadata">

### Author: ![nextr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nextr/32/3131_2.png) [@nextr](https://discourse.julialang.org/u/nextr)
#### Post date: [January 23, 2018, 9:34am UTC](https://discourse.julialang.org/t/embedding-non-base-module-julia-function-in-c/8449/4 "2018-01-23T09:34:48Z")

</div>

You’re right. Not the same subject.  
Sorry
