-
I'd like to have a DllMain, but on Linux. Edit: I know the dangers of using DllMain in managed, but I understand what I'm doing. I'm already hooking into another thread, which allows me to use the System API either way. |
Beta Was this translation helpful? Give feedback.
Answered by
jkotas
Jul 8, 2024
Replies: 2 comments 15 replies
-
You should never do DllMain in managed code |
Beta Was this translation helpful? Give feedback.
10 replies
-
Check #66546 |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The portable version are C++ global static constructor (or their low-level platform-specific mechanism - DllMain on Windows, https://stackoverflow.com/questions/39540364/does-static-initialization-and-or-other-code-get-run-when-dlopening on Linux and other ELF-based platforms, ...). You can create C++ file with global static constructor that calls back into your method, compile it to .obj/o, and link this .obj/o to your app. It comes with the same disclaimer as DllMain. It is not a reliable solution.