Skip to content
Discussion options

You must be logged in to vote

You are calling LoadLibrary from DllMain, some that is explicitly not allowed. See Dynamic-Link Library Best Practices. Using managed code is also on the list.

Perhaps on DLL_PROCESS_ATTACH use CreateThread to call your load_dll function, rather than calling it directly?

hostfxr_close potentially takes a lock and uses memory management functions ( see here ). Those are also not allowed in DllMain. And the host handle is not thread safe ( see here ). So I'm not sure what is the right way to clean that up.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Samuil1337
Comment options

@Samuil1337
Comment options

Answer selected by Samuil1337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants