c++ - Access global variable in runtime-linked dll -
I need to use the Global variable of some legacy DLL in run time. I have a header file for global variable definition Is struct CmpSys {public: static const int NAME_LEN = 21; Four SJNM [NAME_LEN]; // user-defined system name} global variable is a c ++ Dll is packed in CmpSys ** gapCmpSys In my CPP file I hDEWModelDll = LoadLibrary ( L "DEWModel.dll"); (CMPSIS **) PTRCMPSIs = (CMPSIS **) GETPROCODERES (HDWodeldale, "GpsCMPCS"); The debugger shows that there is a valid address of ptrCmpSys (not a null), but the content is absolutely wrong. If I write ptrCmpSys [0] -> SzNam I'll get a weird chat string. What should I do?