I want to make a BLAS implementation but want to be able to use a provided implementation if I decide to. So, I would like to have a function
const c = @import("c.zig");
pub fn dasum(n: isize, x: [*]f64, incx: isize) f64 {
return c.cblas_dasum(n, x, incx);
return some_zig_implementation(n, x, incx);
}
where c.zig is something like:
pub usingnamespace @cImport({
@cInclude("cblas.h");
});
The idea is that dasum would choose either the provided implementation (c included file) or the zig implementation depending on whether that external implementation (in the form of a shared object most probably) was provided or not. How can I do this?