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

Observation: 'library lifetime may be removed if CgosLibUninitialize is made inaccessible in rust API #3

Open
Farmadupe opened this issue Nov 13, 2024 · 0 comments

Comments

@Farmadupe
Copy link

Farmadupe commented Nov 13, 2024

The cgos-rs lifetime 'library is currently used to make sure that any cgos-rs object cannot live past the time when the underlying libcgos is uninitialized (function CgosLibUninitialize). In cgos-rs, this is done when any Congatec object is dropped.

However if in cgos-rs, if CgosLibUninitialize is never called, then this lifetime would no longer need to be tracked. The CGOS API docs state that the only reason to unitialize libcgos is to reclaim memory, however I suspect that there are very few users who are so memory constrained that they need to deallocate it.

This effects of this change would be:

  • The lifetime 'library would be removed from codebase.
  • Since the purpose of the Congatec struct is solely to track the lifetime of libcgos, it would no longer need to exist. Board::new would be modified to query whether libcgos was already initialized (CgosLibIsAvailable) and then initialize it if necessary (CgosLibInitialize)
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

1 participant