feat!: Use struct exports for all plugin types, separate error model and simulator#169
Draft
jake-arkinstall wants to merge 6 commits into
Draft
feat!: Use struct exports for all plugin types, separate error model and simulator#169jake-arkinstall wants to merge 6 commits into
jake-arkinstall wants to merge 6 commits into
Conversation
… method of passing simulators (and wrapped simulators) to the error model
… they are provided in structs now
…ers only. Some work to be done wrt cbindgen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Presently, all components expose C functions. We then load those up and invoke them as-if they were struct fns.
This causes some painpoints. A relatively minor example is that support for optional functions is informal at best.
A much more prevalent example is that we have reason to move ownership of simulators away from the error model, such that we may track communication between the two - the cleanest mechanism for this is to provide the simulator to the error model through dependency injection.
To this end, we need an FFI-friendly concept of "an instance pointer and a bag o' methods", such that we can export a simulator as a C struct and pass that to the error model.
If we are to go down that route, it makes a lot of sense to make this representation the primary C interface for plugins, including at the dylib level.
In this PR, we attempt that. As there was a lot of repetitive work, it was done with the help of Codex, so expect some level of fluff. Plugins expose a struct instance containing function pointers. This can then be consumed, potentially wrapped, and then re-exposed for the purpose of dependency injection over a C FFI boundary.
This is not complete work as of yet. To demonstrate the value of it, I wish to perform the following additional work: