How to compile the julia code into c language?

In section 22.2 of the OpenModelica User Guide it describes how to call Python code by using the standard Python API (in Python.h) and linking libpython.

You can do exactly the same thing with julia.h and libjulia.

5 Likes

@stevengj Thank you very much!

I have looked at section 22.2 of the OpenModelica User Guide which looks helpful. However, I came a cross this part
Screenshot 2022-02-17 184503

In which I dont know how to define the settings that are compatible for Julia instead of python-config --cflags > pycflags" and “python-config --ldflags > pyldflags”) in the OMEdit of Openmodelia

I got lost in the conversation. Did you try creating a shared library with PackageCompiler, and making your julia function callable via Base.@ccallable yet? You can then write some glue code in C that calls your julia function.

https://docs.juliahub.com/PackageCompiler/MMV8C/1.2.1/devdocs/binaries_part_2.html#Interacting-with-Julia-through-libjulia.-1

I am going to ask a controversial question. How much time do you have invested in Modelica? Would you be able to find similar functions in Julia packages?
If you can say what you are working on maybe some people here can suggest equivalents in Julia? For instance

1 Like