A
Anurag_S_Sharma
Guest
I have a DLL that contains both code (exported functions) as well as data (binary data embedded as a resource).
This DLL is statically linked into my program (EXE). In order to get access to the binary data in the DLL, I need a handle (HMODULE) of this DLL so I can pass this handle to Win32 APIs like FindResource() et al.
My query is which function - LoadLibrary() or GetModuleHandleEx() - I should be using on this statically linked DLL so that the returned handle is guaranteed to be non-NULL (ie valid).
I referred to MSDN docs on GetModuleHandleEx(). It says that this API is to be used to get the handle of already loaded modules but it does not say what the behavior will be when it's used on statically linked (which can also be assumed to be already loaded) DLLs.
LoadLibrary() serves me just fine but my concern is if it will incur extra overhead in loading the statically linked DLL again into my program's address space? or will using LoadLibrary() merely increment the ref count of the DLL?
Continue reading...
This DLL is statically linked into my program (EXE). In order to get access to the binary data in the DLL, I need a handle (HMODULE) of this DLL so I can pass this handle to Win32 APIs like FindResource() et al.
My query is which function - LoadLibrary() or GetModuleHandleEx() - I should be using on this statically linked DLL so that the returned handle is guaranteed to be non-NULL (ie valid).
I referred to MSDN docs on GetModuleHandleEx(). It says that this API is to be used to get the handle of already loaded modules but it does not say what the behavior will be when it's used on statically linked (which can also be assumed to be already loaded) DLLs.
LoadLibrary() serves me just fine but my concern is if it will incur extra overhead in loading the statically linked DLL again into my program's address space? or will using LoadLibrary() merely increment the ref count of the DLL?
Continue reading...