April 29th, 1999, 12:55 PM
Hi,
How I use anyone global variable declared in EXE module in DLL ? After declare it in DLL I have error "LNK2001: unresolved external symbol"
Thanks
April 30th, 1999, 07:12 AM
You must put __declspec(dllexport) before the variable in the DLL and __declspec(dllimport) before the variable in the exe.
kevin
April 30th, 1999, 09:43 AM
In a DLL, you cannot use a variable defined in another module unless you import it. In your case, it is easy to define the variable in a new separate dll, make sure you export it (put declspec(dllexport) before the declaration). Then you can use the variable in your own dll and your executable, but make sure you import it (use declspec(dllimport) to declare the variable). You need to provide the import library (.lib file) generatd along with the new dll to link your own dll and your executable.