Closed recanman closed 6 months ago
Found that I'm missing static arrays parsing, working on
Any estimate as to when this will be completed? This is an extremely useful library. I've been manually writing a list of symbols for libvirt.h until this hopefully can be fixed.
Just created new branch union_array_support
Can you test it please? Currently implemented unions and arrays as Buffers for serialization. If current implementation works good, than (may be) I'll add some wrappers for unions/arrays
Also added addIncludeDir
, just call it like this before anything else:
import path from "path";
addIncludeDir(path.resolve("./include"));
Here is my generated result:
Thank you very much. I'll test it out today and let you know if there are any issues.
I see that mylib.so/dylib
is hardcoded as the name. That initially gave me some issues.
Otherwise, everything worked.
You can specify it like this:
new CodeGen({
// .so / .dylib / .dll will be appended by bun's suffix
funcSymbolsImportLibPath: `import.meta.dir + "/libvirt"`,
})
Or replace whole code around it (without suffix append):
new CodeGen({
funcSymbolsImportLibPathCode(out) {
out.push(`
let _LIB_PATH: string = "";
if (process.platform == "darwin") {
_LIB_PATH =
import.meta.dir +
"/../wgpu/libwgpu_native.dylib";
} else {
throw new Error("not supported wgpu bindings platform");
}
`);
// return variable name that hold path to lib
return "_LIB_PATH";
}
})
I am using
libvirt.h
Code I used (almost identical to the example code):
I ran it in Bun's alpine Docker image, and I got the following error:
Dockerfile: