|
-
April 29th, 1999, 12:55 PM
#1
How I use global variable defined in EXE module in DLL ?
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
#2
Re: How I use global variable defined in EXE module in DLL ?
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
#3
Re: How I use global variable defined in EXE module in DLL ?
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|