Essence of the code regarding issue:
Code:
typedef struct BMS_Chkmem{
int elemsize;
} BMS_CHKMEM;
typedef struct BMS_Blkmem{
BMS_CHKMEM* chkmemhash[1013];
} BMS_BLKMEM;
typedef struct SCIP_Mem{
BMS_BLKMEM* setmem;
} SCIP_MEM;
void* allocMemory(size)
{
void* ptr;
ptr = malloc(size)
return ptr;
}
BMS_BLKMEM* createBlockMemory(void)
{
int i;
BMS_BLKMEM* blkmem;
blkmem = allocMemory(sizeof(*(blkmem)));
for (i=0; i < 1013; i++)
{
blkmem->chkmemhash[i] = NULL;
}
return blkmem;
}
void memCreate(SCIP_MEM** mem)
{
mem = allocMemory(sizeof(**(mem)));
(*mem)->setmem = createBlockMemory();
if ( (*mem)->setmem->chkmemhash[60] == NULL)
printf("Is null\n");
else
printf("Is not null\n");
}
int main(void)
{
SCIP_MEM* mem;
memCreate(&mem);
return 0;
}
The above code is simple the essence of what I'm using, I'm not even sure if it would compile, but I hope it contains everything needed.
memCreate is called, and is passed a pointer of a higher struct, which at the time is NULL, the idea being to allocate it some memory, and initialize it. When I try to compile the code that this is taken from, I get an error of:
dereferening pointer to incomplete type
This error relates to:
if ( (*mem)->setmem->chkmemhash[60] == NULL)
From what I can see, this should work, but clearly I'm overlooking something.