Reputation: 1
I want to link a .dll dynamically. What are the multiple ways to do so?
One way I know, is by using HMODULE WINAPI LoadLibrary(_In_ LPCTSTR lpFileName)
function.
Is there any other way?
I am trying to understand the below code:
#if defined WIN32
// We want to define DTE_DLL_EXPORT if we are making
// a dll, but not if we are making a static library...
#if defined DTE_STATIC
#define GFITDTE_ENTRYPT
#else
#if defined _GFITDTE_BUILD_
#define GFITDTE_ENTRYPT __declspec(dllexport)
#else
#if defined DTE_IMPORT
#define GFITDTE_ENTRYPT __declspec(dllimport)
#else
#define GFITDTE_ENTRYPT
#endif
#endif
#endif
#else // Not WIN32
Can some on explain the above code??
Upvotes: 0
Views: 36
Reputation: 179779
The code shown has nothing to do with LoadLibrary
. It's typical for header files, which in turn means you're building a DLL that's NOT supposed to be loaded via LoadLibrary
. Instead, the compiler knows the function prototypes from the header, and the linker uses an import library to set up the DLL linking.
Upvotes: 1