When I build my C++ project with .exe output in Visual Studio, it creates a .lib and .exp file of my project, and it takes a lot of time. I added the _DO_NOT_EXPORT condition at the beginning of stdafx.h (precompiled header) in attempt to skip this step, but it still creates .lib and .exp files at the end of every build. Have I added the condition at the right place ?
Asked
Active
Viewed 1,793 times
3
-
3You'll have to find the `__declspec(dllexport)` attribute in the source code and do whatever necessary to ensure that the compiler doesn't see it. That isn't always practical, it might not be your code. Then you just say "aw shucks". – Hans Passant Aug 06 '15 at 15:15
-
@HansPassant I believe the __declspec(dllexport) attribute is defined somewhere in a boost library I include in stdafx.h, so if I understand correctly in this case there is no way to disable dllexport ? – DreamTool Aug 06 '15 at 15:16
-
Some of boost's libraries (like Thread) can only be linked dynamically, but most of them shouldn't be doing dllimport (much less dllexport) automatically. – melak47 Aug 06 '15 at 17:16
1 Answers
0
For what it's worth, you may disable the block
#if defined(BOOST_HAS_DECLSPEC) && !defined(__COMO__)
# if defined(__BORLANDC__)
# define BOOST_DLLEXPORT __export
# else
# define BOOST_DLLEXPORT __declspec(dllexport)
# endif
#elif ! defined(_WIN32) && ! defined(_WIN64)
# if defined(__MWERKS__)
# define BOOST_DLLEXPORT __declspec(dllexport)
# elif defined(__GNUC__) && (__GNUC__ >= 3)
# define BOOST_USED __attribute__ ((used))
# elif defined(__INTEL_COMPILER) && (BOOST_INTEL_CXX_VERSION >= 800)
# define BOOST_USED __attribute__ ((used))
# endif
#endif
in serialization/force_include.hpp
of Boost.
Reference: http://lists.boost.org/boost-users/2008/06/37175.php