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

Wrap cgo calls with an interface #140

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

qmuntal
Copy link

@qmuntal qmuntal commented Aug 19, 2020

Changes:

  • Abstract all cgo with an interface that accepts accepts and returns cgo types
  • Do all the go<->cgo heavy lifting in Wrapper but delegate the real cgo call to the interface.
  • Create one interface implementation for dynamic loading, maybe called DynamicWrapper. Put all the related c and go code in a separated files. Add an opt-out tag (act_dynload)? to this file so users that don't need it can remove it at build time.
  • Create one interface implementation for static/dynamic linking, maybe called LinkWrapper. Put all the related c and go code in a separated files. Add an opt-in tag (act_link)? to this file for users who want to support this mode.

This allows to support the two scenarios and any combination of them with a small runtime overhead.

Updates: #123

@qmuntal qmuntal changed the title Wrapp cgo calls with an interface Wrap cgo calls with an interface Jan 11, 2021
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.

1 participant