-
Notifications
You must be signed in to change notification settings - Fork 18
Description
By default Numbast generate bindings out of parsed declaration. The bridge between the Numba ABI and the C++ code usually includes the original parsed header, for example:
#include <foo.h>
extern "C"
int __<mangled_name>_foo_nbst(int *ret, int *arg1, int *arg2) {
*ret = foo(arg1, arg2);
return 0;
}There are two scenario for foo.h. One situation is that foo.h contains all of the definition and declaration of the shim function, that's the case when foo.h is a considered a header-only library. The second situation is that foo.h is only a file that contains the declarations. Library developers will provide their own implementations downstream at linking stage.
This issue is on improving the latter situation. The shim function does not need to depend on the header file used to parse the declaration. Instead, the shim function can contain just the subset of the forward declaration of the bindings used in the kernel. In essence, instead of above, the shim function can just look like:
int foo(int, int);
extern "C"
int __<mangled_name>_foo_nbst(int *ret, int *arg1, int *arg2) {
*ret = foo(arg1, arg2);
return 0;
}Therefore removing the dependency of the shim function to the source header.