Description
This feature is the opposite of #1613. When creating some function that is exposed to C, such as:
@ccallable(header="some_header.h")
def f(x: i32) -> f64:
"Some documentation."
return x + 1
it will not only create the function f
that is callable from C, but it would also emit / create a C header file some_header.h
that would contain the C signature, together with the docstring as documentation (using C comments).
We want to be able to specify different @ccallable
in separate files and they would all contribute to the same C headerfile. Probably one could configure this using a command line argument, but one solution is to create the header file if it does not exist, and then keep appending to it (specifically, inserting into it, since there are typically the ifdef macros at the beginning and end). Another solution is to compile all the separate files into one ASR, and then create the headerfile at once.
We can also only emit the header file if requested at the command line.