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

C++ function wrapper #34

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

C++ function wrapper #34

wants to merge 4 commits into from

Conversation

mullroy
Copy link

@mullroy mullroy commented Dec 23, 2021

Good day,
I've created C++ library access functions in lib.rs.
The C++ header file and demo application is contained inside the C++ sub directory.

Improved error handling so that library doesn't !panic, but returns an error code.
Handle the error inside your program instead of your program unexpectedly exiting.
@wigy-opensource-developer

Ahoy! I do not want to belay your efforts, but putting these functions and their imports into the lib.rs seems to be a bit intrusive to me. There are 2 ways to get it out from there:

  1. Create a module (say mod cpp) and extract them there.
  2. Create another crate that depends on this one and put it there.

The second has the advantage that build times do not increase for those who only use this crate from Rust. And has the disadvantage that it is difficult to notice your crate when someone only knows this one. Although I sometimes check the dependent crates of a crate to see how they are used: https://crates.io/crates/tiny-bip39/reverse_dependencies

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

Successfully merging this pull request may close these issues.

2 participants