Dear all,
I am working on developing and compiling a large Julia project. To facilitate the development process, I hope to compile the project incrementally, similar to the procedure used in C and C++ projects.
For instance, in a C++ project with three files (a.cpp, b.cpp, c.cpp), we can compile each file into object files (a.o, b.o, c.o) using a Makefile. Then, we link them together to create an executable program. This allows us to easily modify individual files.
Using StaticCompiler in Julia, we can generate IR code from the required functions and compile them into object files. However, there is a challenge: to compile a function, all the functions it invokes must be provided. For example, consider the following function that calls a fib function:
function double(x::Int64)
return 2 * fib(x)
end
If we want to compile the double function separately, we need a way to defer the compilation of the fib function. This means compiling double function into an object file without requiring fib to be defined at the same time. One possible solution is to use a function declaration for fib, similar to how header files work in C or C++.
If anyone has suggestions or improvements, they would be greatly appreciated.
Dear all,
I am working on developing and compiling a large Julia project. To facilitate the development process, I hope to compile the project incrementally, similar to the procedure used in C and C++ projects.
For instance, in a C++ project with three files (a.cpp, b.cpp, c.cpp), we can compile each file into object files (a.o, b.o, c.o) using a Makefile. Then, we link them together to create an executable program. This allows us to easily modify individual files.
Using StaticCompiler in Julia, we can generate IR code from the required functions and compile them into object files. However, there is a challenge: to compile a function, all the functions it invokes must be provided. For example, consider the following function that calls a fib function:
If we want to compile the double function separately, we need a way to defer the compilation of the fib function. This means compiling
doublefunction into an object file without requiringfibto be defined at the same time. One possible solution is to use a function declaration for fib, similar to how header files work in C or C++.If anyone has suggestions or improvements, they would be greatly appreciated.