Add custom prefix to autogenerated C functions #268
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.
In #259 I refactored the C bindings to autogenerate them. While doing that, I removed the
go_openssl
prefix from them, leaving the C function names with the same name as defined in the OpenSSL headers.The problem is that when this Go module is compiled as a shared library, dynamically loaded in another module, and that module ends up dynamically loading the real OpenSSL (which is the case of all the OpenSSL providers) then the OpenSSL functions that we defined are loaded twice, from us and from OpenSSL, causing undefined behavior.
To avoid this issue, we better add a custom prefix to the autogenerated C functions. This PR does that by applying the following changes:
_mkcgo_
.zossl.h
, not just the one needing an error wrapper, asshims.h
no longer contains real function names (unless OpenSSL is dynamically loaded).shims.h
forzoosl.h
in those fails that were including it.