I'm new to DLL programming and I'm tryng to develop a program with some DLLs that use a single global variable defined inside the main application (.exe).
In short words, I don't understand how to import the global variable inside different DLLs and allow them to modify it.
I try to use this code to declare the resource in the .h of DLL
extern "C" __declspec(dllexport) varType varName;
but it does not seem to work, in fact different DLLs use different structures.
Also using
extern "C" __declspec(dllimport) varType varName;
the program desn't work properly.
What is the correct way to allow the sharing of the resource among main process and DLLs?
I know that share resources from main process to DLL is not right but I'm forced to do in this way. Furthermore I can't use functions that receive the pointer to the structure that I want to modify.