This doesn't fit in the playground, as far as I can tell, so I made a github repo for it:
Basically, I have found that a cdynlib depending on an upstream repo that contains functions with "C" linkage (and #[no_mangle]
) causes those symbols to be exported to the cdynlib, even if they are not used.
This seems to happen even with LTO enabled. I can't figure out what it is happening or how to stop it from including unused symbols.
This is not "incorrect" behavior per se, but it could cause trouble down the road if these symbols conflicted because they appeared in two different libs used by a downstream project. Being able to control what is exported is important.