-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows DllMain name is exported #67399
Comments
I think the main issue here is that |
I just had a short look because I wanted to try two ideas:
To start off I tried modifying I can neither find any references to |
I desperately need some mechanism: |
Is there any solution to this problem? |
i've also notice rust seems to put my package name in rdata section, is there anyway to prevent it? i couldn't find any info about it other than removing panic strings / path which doesnt solve my issue. |
A workaround is to write your own |
See the first reply in this issue for caveats. |
On Windows, Rust exports the name of
DllMain
(std
) /_DllMainCRTStartup
(no_std
), which is not standard behaviour and unwanted in most cases (that I am aware of). As far as I understand this happens because they must be marked with either#[no_mangle]
or#[export_name = ".."]
so thelink.exe
can find the symbol. Theextern
keyword must also be used to mark them asstdcall
for 32 bit targets.Example project:
Cargo.toml
lib.rs (
std
)lib.rs (
no_std
)dumpbin output
Example Windows dll file:
Rust example from above (
std
):Rust example from above (
no_std
):Expected output
DllMain
and_DllMainCRTStartup
should not be exported by name, just as in the first dumpbin output example of a Windows system dll.Tested compiler version
The text was updated successfully, but these errors were encountered: