Julia v0.3 interface with C / C++

Hello,

I’m new in Julia. I inherited of a project on Julia v0.3 and need to use it from within a C program.

The steps I want to achieve are :

  • Compile my Julia project to create a .ji file
  • create .so library of my julia project
  • write a .h interface in order to use it from my C project

The problems I encountered start at the begin : While v0.4 and upper of julia compiler has a --output-ji option, in v0.3 I don’t know how to do that.

Anyone knows how can I create a .ji precompiled file using Julia v0.3 ? Is there any package compatible to v0.3 to do so ?

Thank you in advance.

Nextor

Hi Nextor, welcome to the Julia community!

If you’re planning on maintaining this project I’d recommend you upgrade
to a more recent Julia version. A lot of development has happened since
0.3, and most help you’ll find on the forums will be from folks with
experience in more recent ways of doing things.
One process for upgrading would be to first run the code with Julia 0.4,
which will display deprecation warnings that should also provide
guidance for what needs to change, then do the same with Julia 0.5 and
0.6. If you try to go straight from 0.3 → 0.6 there will be things that
show errors rather than deprecation warnings.
Also 0.7 is on the horizon, so in the coming weeks and months there will
be other folks making the 0.6->0.7 transition and you’ll be in good
company. :slight_smile:
Also, depending on your deployment environment you don’t necessarily
have to statically-compile your package into a .so file, you can just
link against libjulia.so and load your code the same way the normal
julia process would. See the [embedding page of the manual]
(https://docs.julialang.org/en/stable/manual/embedding/#) for more info.
-s

8 Likes

Hi SSFRR, thank you for your response !

I think I will take into account your opinion and try to upgrade this project to the latest stable version of Julia.

Thanks for your help.

Nextor