Scope issue

Hi!

I wrote two DLLs. One is called only by an EXE and the other is called by the EXE and another DLL that I wrote. The DLL that is called only by the EXE works fine. My issue is with the DLL that is called by the other DLL.

Each of the two DLLs has an initialization function that is called when the DLL is loaded by the EXE. The function reads an int from a file and stores the data into variables that are global to a CPP file in each respective DLL. Here's the flow in a nutshell.

The EXE loads DLL1 and runs its initialization function.

An int is read from a file and stored into a variable that is global to a CPP file in DLL1.

The EXE loads DLL2 and runs its init function.

An int is read from a file and stored into a variable that is global to a CPP file in DLL2.

A function in DLL1 calls an exported function in DLL2 that is in the same CPP file where the global data was stored.

The value of the data is now 0 instead of what it was when stored during the initialization function.

Can anyone help me figure out how to resolve this issue?

Thank you very much!
Topic archived. No new replies allowed.