Load a DLL More Than Once?

后端 未结 3 1363
醉酒成梦
醉酒成梦 2021-01-04 21:44

I\'m using the LoadLibrary function to load a DLL in Windows. My question is this: If I call this method more than once for the same DLL, do I get handles to different insta

3条回答
  •  悲&欢浪女
    2021-01-04 21:52

    If the DLL is already loaded, LoadLibrary will simply return the address of the library in memory. However, DllMain is not called again with DLL_PROCESS_ATTACH when the second load is attempted. Handles in the sense of libraries are just memory locations, so the value you get the second time around should be the same as the first.

    As far as linux SO files go, I don't see why they would load twice either. However, someone else will have to weigh in on this to give you a proper answer.

提交回复
热议问题