Right now, every @ccall always generates a C forward declaration (in the C backend). In addition, we would also like to have a mode, something like:
@ccall(header="some_header.h")
def f(x: i32) -> f64:
pass
@ccall(header="some_header.h")
def g(x: i32) -> f64:
pass
# later
e = f(5)
h = g(5)
Which would generate the following code:
#include "some_header.h"
...
e = f(5)
h = g(5)
and it would not forward declare f and it would only include some_header.h once. So in particular, if f is actually a C macro declared in the some_header.h file, it would also just work.
Alternative syntax:
from ltypes import headers
h = headers("some_header.h")
@ccall(h)
def dummy():
pass
@ccall
def f(x: i32) -> f64:
pass
# later
e = f(5)
We might need to figure out the best design, but we need this feature.
Right now, every
@ccallalways generates a C forward declaration (in the C backend). In addition, we would also like to have a mode, something like:Which would generate the following code:
and it would not forward declare
fand it would only includesome_header.honce. So in particular, iffis actually a C macro declared in thesome_header.hfile, it would also just work.Alternative syntax:
We might need to figure out the best design, but we need this feature.