Calling LoadLibrary from DllMain

后端 未结 5 1221
醉话见心
醉话见心 2020-12-16 08:48

MSDN says:

It must not call the LoadLibrary or LoadLibraryEx function (or a function that calls these functions), because this may create dependen

5条回答
  •  情歌与酒
    2020-12-16 09:25

    Your argument in favor of going ahead with this seems to be, to paraphrase:

    Microsoft says don't do this, but my single test case seems to work, therefore I fail to see why nobody should be doing this.

    You're operating under a big assumption: you're assuming that the underlying implementation of the Windows loader will never change. What if the loader is changed in "Windows 8" in a way such that your code no longer works properly? Now Microsoft gets blamed for it and they have to include yet another compatibility hack to work around code that they told you not to write in the first place.

    Follow the guidelines. They're not there just to make your life more difficult, they're there to guarantee that your code will work just as well on the Windows of the future as it does now.

提交回复
热议问题