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.
Implements
check_linked_version()
in a standalone file that can be copied in zero-dep packages. After some testing in other packages it will be exported from rlang as well.Packages that include native code are fragile on Windows and might not be properly updated. When the package is loaded in memory, R might install a new version of the package without updating the corresponding DLL because. With
check_linked_version()
you can preventively inform your users about broken installation.It should be called from the
.onLoad()
hook:It expects that the namespace of the checked package contains a C callable called
*pkgname*_linked_version()
. This callable should return the package version as a string. The version recorded in the native library is then compared to the one returned frompackageVersion()
. If they don't match, an informative error is thrown:On Windows the error message includes additional advice from rstats-wtf/what-they-forgot#62 about safely reinstalling packages:
A usethis tool will eventually make it easy to generate an up-to-dateversion.c
file at each version bump.