-
Notifications
You must be signed in to change notification settings - Fork 46
Is it possible to use foreign types? #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
No, this is not currently possible. It might be possible to do something like this (allowing opaque C++ types to exist on the Rust stack - you'd still need cpp! blocks to call methods on the types) once we get something like |
@mystor, btw, why would you need impl Trait for this? |
I'm not sure if I would. I had one idea for how to implement it which would require it but I haven't had time to think through the options. |
I thought you were talking about creating opaque structs of the same size and alignment as their C++ counterparts. |
This is now possible with cpp_class! from #28 #[macro_use]
extern crate cpp;
cpp!{{
#include <glm/glm.hpp>
}}
cpp_class!(unsafe struct vec3 as "glm::vec3");
fn main() {
let x = unsafe { cpp!( [] -> vec3 as "glm::vec3" { return glm::vec3(1,0,0)]; }) };
} |
Is it, or will it be possible to use types from c++? I didn't find that in the documentation nor in the tests.
I'd like something like that:
The text was updated successfully, but these errors were encountered: