Morglod / bun-ffi-gen

FFI bindings generator for Bun
MIT License
13 stars 0 forks source link

clang11 problem #3

Open spidunno opened 3 months ago

spidunno commented 3 months ago

I tried the example given in the readme with the latest version of wgpu-native for the github page for it, it seems to create an error with one of the structs and tries to run c code containing sizeof(undefined). not sure how to really fix this

Morglod commented 3 months ago

Hi! Will check it

What system & compiler version you have?

And attach please yours wgpu.h

spidunno commented 3 months ago

I'm on Ubuntu (WSL) and clang --version reads

Ubuntu clang version 11.0.0-2~ubuntu20.04.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

here is my wgpu.h (github doesn't support .h files so I uploaded it to a file server) https://ninja.dog/1B71ry.h

Morglod commented 3 months ago

For me everything works (both with latest wgpu-native & yours wgpu.h) clang13, macos

Could you provide some logs or investigate with which struct error happens?

Here is my result (you should adjust _LIB_PATH variable inside it): wgpu.ts.zip


Probably your error happens somewhere at src/parser.ts:370

By some reason struct declaration has no name on it. May be you changed this headers somehow? Or clang11 exports different ast. Could you upload json result of clangGetAstJson?

writeFileSync('./ast.json', await clangGetAstJson('./wgpu.h'));