Is there any proper way to use Opencl/Cuda/Vulkan in rust?[SOLVED]

Hi guys.
I think my question is obvious.
I don't want any rust library that is designed to bring Opencl/Cuda/vulkan to rust. most of them are out dated, not stable and not complete. Just rust and its standard library.

You should have a look at the packages from @tomaka. Especially vulkano (https://crates.io/crates/vulkano), glium (https://crates.io/crates/glium) and glutin (https://crates.io/crates/glutin).

I haven't tried vulkano yet, but it seems to be the most sophisticated implementation so far.

Edit: I misread your question a bit. I don't have a suggestion for OpenCL/Cuda.

thanks for your information.
but I don't want any packages to work with ONE SPECIAL C/C++ framework.
i want a way to access C/C++ frameworks through rust itself + its standard library or a package that is designed to bring c/c++ libraries to rust (not just one of them)

imagine i want to use a c/c++ framework that no package in crates.io is designed to bring it to rust or there is but it is outdated. What should I do? how 'vulkano' brings vulkan to rust?

To be honest, I don't really understand what you're looking for.

Vulkan has a C-API and https://crates.io/crates/vk-sys provides the pure naked rust-bindings for them. Vulkano is a wrapper which provides a Rusty look-and-feel for vk-sys.

Neither of them is a framework - they're just a thin wrapper and are thightly bound to the official specification. You won't find anything more official, unless die Rust team decides to integrate Vulkan into std, what hopefully never will happen :slight_smile:

I think I have to do more research about what is library,framework, api ... :slight_smile:

my question in one line : is there any way to use a librarie or framework in rust language?and that library/framework is written for c,c++

arrayfire. Multilingual.

1 Like

"Yes" for C, "No" for C++ (AFAIK)

Accessing a C-API is called Foreign Function Interface: Have a look at the documentation: FFI

There is no crate or API that gives you universal access to any C/C++ library. You have to manually write, or generate bindings using bindgen for the specific C/C++ library you want to use and then use that binding from Rust.