Load a DLL More Than Once?

后端 未结 3 1386
醉酒成梦
醉酒成梦 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 22:02

    For Linux shared objects, from the dlopen(3) manpage:

    If the same library is loaded again with dlopen(), the same file handle is returned. The dl library maintains reference counts for library handles, so a dynamic library is not deallocated until dlclose() has been called on it as many times as dlopen() has succeeded on it. The _init() routine, if present, is only called once. But a subsequent call with RTLD_NOW may force symbol resolution for a library earlier loaded with RTLD_LAZY.

提交回复
热议问题