I haven't looked at the specific issue, but Windows can export data from a DLL into another DLL.
The data to be exported should be declared __declspec(dllexport), and when it is required to be imported declared as __declspec(dllimport).
The attached zip includes a DLL (dllexport) that exports a value (myData) along with a function (initData) to initialise the data, a second DLL (dllimport) that imports the value and exports a function to return the value, and a main that initialises the data with a call into the first DLL and then retrieves the value with a call to the 2nd DLL.
Compile with:
cl /LD dllexport.c
cl /LD dllimport.c dllexport.lib
cl main.c dllimport.lib dllexport.lib
running main.exe gives the expected out value.
Normally macros would be used such that the same header file is used for both export and import changing the __declspec() mode depending on what is to be done via a compilation definition. Doing this though, does preclude doing both import and export from the same DLL.
Attachment:
dlltest.zip
Description: Zip archive