I've got two modules. One calls other one and passes as an argument a structure.
struct {
char* szDGRTag;
bool bTagEx;
} ADPTAG;
Master is written in C++ from '98 in Visual C++ 6.0. Slave is written in C++ 11 in Visual Studio 2010 Professional.
Function that is called in Slave:
long lCheckPresenceOfFields (char* szName, ADPTAG* AdpTagList, long lNbVar)
In Master:
long lNbVar = 2;
ADPTAG* AdpTagList = NULL;
AdpTagList = new ADPTAG[lNbVar];
AdpTagList[0].szTag = new char[32];
AdpTagList[0].bTagEx = true;
memset(AdpTagList[0].szTag, 0x0, 32+1);
AdpTagList[0].szTag = NULL;
AdpTagList[1].szTag = new char[32];
AdpTagList[1].bTagEx = true;
memset(AdpTagList[1].szTag, 0x0, 32+1);
AdpTagList[1].szTag = NULL;
int size = sizeof(AdpTagList[0]);
AdpTagList[0].szTag = "DDD";
AdpTagList[1].szTag = "AAA";
long pres = pGetFieldsPresence(szPath, AdpTagList, 2);
I've checked size of AdpTagList[0] in Master and it was 5 bytes, but in Slave it is 8 bytes, so the first object is OK, but any next is bad, because pointer points to wrong memory area.
What can be the issue here? Different compilator? Probably not as structure with only char* and int works fine between these two modules.
Regardlesss of size of 1st object [0], second [1] is null-pointer.