<p>I'm just looking for a simple, concise explanation of the difference between these two. MSDN doesn't go into a hell of a lot of detail here.</p>

[{'answer_id': 58026, 'author': 'rpetrich', 'author_id': 4007, 'author_profile': 'https://Stackoverflow.com/users/4007', 'pm_score': 7, 'selected': True, 'text': "<ul>\n<li><p><code>__declspec(dllexport)</code> tells the linker that you want this object to be made available for other DLL's to import. It is used when creating a DLL that others can link to.</p></li>\n<li><p><code>__declspec(dllimport)</code> imports the implementation from a DLL so your application can use it.</p></li>\n</ul>\n\n<p>I'm only a novice C/C++ developer, so perhaps someone's got a better explanation than I.</p>\n"}, {'answer_id': 58029, 'author': 'morechilli', 'author_id': 5427, 'author_profile': 'https://Stackoverflow.com/users/5427', 'pm_score': 4, 'selected': False, 'text': '<p>Two different use cases:</p>\n\n<p>1) You are defining a class implementation within a dll.  You want another program to use the class.  Here you use dllexport as you are creating a class that you wish the dll to expose.</p>\n\n<p>2) You are using a function provided by a dll.  You include a header supplied with the dll. Here the header uses dllimport to bring in the implementation to be used by the current program.</p>\n\n<p>Often the same header file is used in both cases and a macro defined.  The build configuration defines the macro to be import or export depending which it needs.</p>\n'}, {'answer_id': 58030, 'author': 'Antoine Aubry', 'author_id': 2680, 'author_profile': 'https://Stackoverflow.com/users/2680', 'pm_score': 3, 'selected': False, 'text': "<p>Dllexport is used to mark a function as exported. You implement the function in your DLL and export it so it becomes available to anyone using your DLL.</p>\n\n<p>Dllimport is the opposite: it marks a function as being imported from a DLL. In this case you only declare the function's signature and link your code with the library.</p>\n"}, {'answer_id': 58031, 'author': 'Shog9', 'author_id': 811, 'author_profile': 'https://Stackoverflow.com/users/811', 'pm_score': 7, 'selected': False, 'text': '<p><code>__declspec( dllexport )</code> - The class or function so tagged will be exported from the DLL it is built in. If you\'re building a DLL and you want an API, you\'ll need to use this or a separate .DEF file that defines the exports (<a href="http://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx" rel="noreferrer">MSDN</a>). This is handy because it keeps the definition in one place, but the .DEF file provides more options.</p>\n<p><code>__declspec( dllimport )</code> - The class or function so tagged will be imported from a DLL. This is not actually required - you need an import library <em>anyway</em> to make the linker happy. But when properly marked with <code>dllimport</code>, the compiler and linker have enough information to optimize the call; without it, you get normal static linking to a stub function in the import library, which adds unnecessary indirection. <a href="https://web.archive.org/web/20130616032939/http://blogs.msdn.com/b/oldnewthing/archive/2006/07/26/679044.aspx" rel="noreferrer">ONT1</a> <a href="https://web.archive.org/web/20170202195259/https://blogs.msdn.microsoft.com/oldnewthing/20040108-00/?p=41163/" rel="noreferrer">ONT2</a></p>\n'}]
['https://Stackoverflow.com/questions/57999', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3146/']