Embedding Julia in C

I recently created a topic called “Calling my own Julia module from C”, asking a nuts and bolts question about a use case that wasn’t covered by the documentation. I haven’t given up hope on getting an answer, but I thought it might be worthwhile to ask a more general question.

Is calling Julia from C an extremely unusual use case?

2 Likes

It’s not the most common thing to do, but it is certainly done and pretty thoroughly documented:

https://docs.julialang.org/en/v1/manual/embedding/index.html

Was there anything specific you wanted to know that’s not documented in there?

1 Like

I replied to your "Calling my own Julia module from C question. Linking here for reference:

1 Like

What I’m interested in doing is calling functions that aren’t defined in Base, which, as far as I can tell, the documentation doesn’t touch on.

2 Likes

Good idea linking to my other post; I should have done it myself. Thanks again for the lead.

1 Like

Hi Josiah, could you provide the link to your other post where you have done “Embedding Julia in C” described at the beginning of this post?

Realized that the link was already in the thread: https://discourse.julialang.org/t/calling-my-own-julia-module-from-c/23779

I think it could be one of the strongest selling point of Julia if one could easily embed his Julia functions in production code (Which for some reasons must be C / C++). Being efficient way to abstract highly optimized code for production.

I couldn’t find documentation how could one embed a whole self written function which uses different packages and even relies on, let’s say, OpenBLAS.

I also assume this method means code will behave just like regular Julia code with compilation time. While I’d be happy to have a mode which can prevent that with some assumptions.
For instance, Image Filtering with StaticKernels with the kernel and image size to be constant.
Maybe another mode with Pre Compiled Libraries attached to the code.