Calling my own Julia module from C

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.

1 Like

I don’t have too much experience with this but I’ve gotten it to work. I found this thread 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.

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.