Hacker News new | ask | show | jobs
by jeanl 2147 days ago
Do you guys know if it's possible to generate self-standing C++ code from Julia code? (i.e., code that you can then compile into another project, and will not require any interpreter to run or anything like that)? And if it's possible do you know how good the generated code is (in terms of speed)?
2 comments

You can create binaries from Julia and there are APIs to call Julia code from C/C++

https://julialang.github.io/PackageCompiler.jl/dev/devdocs/b...

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

We did have this once upon a time, going from Julia->LLVM->C using the llvm-cbe project (https://github.com/JuliaComputing/llvm-cbe). It is not supported any more, since there are easier ways to achieve what you are asking for. If your code does eval, then there is no way out.

If you can ensure your code and dependencies does not have dynamic things that need compilation at runtime, it is fairly easy to remove the dependency on bundling LLVM. Speed is the same, since you are then just running cached native code.