I created a small DLL and I want it to have an identifier of sorts, so I tried placing this in the DLL:
And then used GetProcAddress to get the address of this variable:Code:#ifdef __cplusplus
extern "C" {
#endif
__declspec(dllexport) const char* NAME = "SomeName";
#ifdef __cplusplus
}
#endif
GetProcAddress doesnt fail; however, name just contains garbage.Code://...after loading the DLL
name = (char*)GetProcAddress(hDll,"NAME");
Defining functions in the DLL works fine, ie:
Any suggestions :confused:Code:extern "C" __declspec(dllexport) void SomeFunc() { /*...*/ }