I've heard that when linking dynamically you need a stub library that has __declspec(dllexport) for every function and variable that you want from the DLL. Now my question is: How does it work exactly? Is it a Visual Studio or C++ keyword and how does it locate the functions and variables from the DLL by name since they are 1s and 0s (machine instructions) for the CPU? And where can I find more information about __declspec and more detail about how it works and what it does?
Asked
Active
Viewed 31 times
0
-
You don't *have* to have it, there are other ways to tell the linker which functions need to be exported (.def file, /export linker option). It is just a very convenient way. It is non-standard since the C++ language specification does not recognize the concept of modules. They've been talking about it for the past 5 years but it isn't going to make it for C++17. – Hans Passant Feb 19 '17 at 21:15
-
I have add a comment to the other question with links to the MSDN. – Sam Hobbs Feb 19 '17 at 22:11