[ffigen] Remove NativeExternalBindings.wrapperName #2832
Merged
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.
The
wrapperNameis the name given to the wrapper class that holds all the function pointers, when using the oldDynamicLibraryBindingsstyle. Under the@Nativestyle the wrapperName shouldn't be necessary, so we wanted to remove it fromNativeExternalBindings.But we were also using it as a unique ID for the bindings as a whole. In native code, where everything is effectively in the same namespace, this ID was used to give globally unique names to the generated functions, in case a user had multiple sets of ffigen bindings in a single project.
These functions aren't user facing, and don't have to be human readable, so I've switched them to a hash based ID. It now hashes the input and output files to generate the ID. Only the file's basename is included, because the full path varies between machines. So it's still possible to have a collision, but it should be unlikely.
Fixes #2580