Skip to content
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

Ways to automate this? #83

Open
IngwiePhoenix opened this issue Jan 31, 2019 · 5 comments
Open

Ways to automate this? #83

IngwiePhoenix opened this issue Jan 31, 2019 · 5 comments

Comments

@IngwiePhoenix
Copy link

Looking at the objects example, I see that most of those functions are actually very generic as they simply check if the arguments passed are NULL or not. So would it be possible to automatically wrap a struct and implementation like this?

(Mind you, I am new to rust and come from c/c++...)

@jhg
Copy link

jhg commented Dec 25, 2020

I'm sorry it's a very late reply, I found this today. Also sorry if it could look spam, but maybe it's what you are looking, @IngwiePhoenix: opaque-pointer crate.

The crate has tests and is documented. It exposes generic functions. Of course, almost functions are unsafe. It's what I use when I need create a static library to be used from C/C++ (and also cbindgen crate).

@IngwiePhoenix
Copy link
Author

Thank you for the ping! Yeah I was not expecting that. But still appreciate it nevertheless. I'll check it out later.

Merry christmas btw. :)

@GandelXIV
Copy link

Any updates on this? I have some ideas for automating this, but would like to see if anyone has also been doing something of this sort.

@jhg
Copy link

jhg commented May 10, 2024

Sorry in advance if it's not the place to talk about it.

@GandelXIV could you explain the ideas for automating this? I was thinking about a derive trait.

@GandelXIV
Copy link

GandelXIV commented May 10, 2024

Sorry in advance if it's not the place to talk about it.

@GandelXIV could you explain the ideas for automating this? I was thinking about a derive trait.

My idea was rather making a CLI tool that would generate C bindings and headers for a givens crate public mumbers. This way, anyone could just pull a library from crates.io and integrate it into their project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants