gecko0307 / bindbc-wgpu

WebGPU for D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generating bindings automatically

chances opened this issue · comments

@gecko0307 From your comment in #7, the wgpu function declarations are being hand-written?

Alternatives

https://wiki.dlang.org/Bindings#Binding_generators

I think a better alternative would be hooking rust's own bindgen functionality to generate d bindings.

Perhaps an abstraction of cbindgen that transforms its Intermediate Representation into a D module with the necessary externs and whatnot?

cbindgen's Internals

Actually, upon thinking about the matter a bit more, I think even better would be for cbindgen to dump its internal representation into some common format—json or similar—which can be consumed by any language. (Like how bindings are automatically generated for xcb and opengl based on xml specs.) I'll file a ticket on cbindgen later.

I just updated the bindings manually for #12 (ugh, 😝️).

@moon-chilled Have you made any progress experimenting with cbindgen?

Finally available with ImportC? https://github.com/chances/wgpu-d

@cyrusmsk Exactly, though wgpu-d is still quite verbose in its "idiomatic" wrapping.

ImportC is magic. 😄