EmbarkStudios / physx-rs

🎳 Rust binding for NVIDIA PhysX 🦀
http://embark.rs
Apache License 2.0
652 stars 42 forks source link

C bindings for other languages? #96

Open amerkoleci opened 4 years ago

amerkoleci commented 4 years ago

Hi, I'm keeping various C# .net bindings, for example vulkan, d3d12, d3d11 etc.

Would be possible to generate C bindings into dll/so/dylib so I can bridge the API?

Feel free to close the issue if not appropriate for the project.

Thanks in advance

repi commented 4 years ago

That is an interesting idea and some base work here is done for as we do generate a C ABI to talk between the Rust and C++ code.

But would say it is out of scope for this project specifically as its goals is to just use PhysX inside Rust, but would be cool if someone uses the same binding mechanisms we used here to create a pure C binding for other languages to use

amerkoleci commented 4 years ago

I see, are the generated C files under repo and compilable?

h3r2tic commented 4 years ago

They are in the repo under https://github.com/EmbarkStudios/physx-rs/tree/main/physx-sys/src, and compilable by Cargo's build.rs mechanism at https://github.com/EmbarkStudios/physx-rs/blob/main/physx-sys/build.rs

amerkoleci commented 4 years ago

Thanks for info's, will try and report back.

neuecc commented 1 year ago

I have started using physx-rs(physx-sys) in C# for the purpose of utilizing a physics engine. With my csbindgen project, I was able to automatically generate complete bindings. https://github.com/Cysharp/csbindgen/blob/main/dotnet-sandbox/libphysx_csbindgen.cs Thank you for sharing this wonderful project.