| Bug #45751 | Static library build broken | ||
|---|---|---|---|
| Submitted: | 25 Jun 2009 13:08 | Modified: | 4 Aug 2009 16:23 |
| Reporter: | dennis knochenwefel | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / C++ | Severity: | S2 (Serious) |
| Version: | 1.0.5 | OS: | Windows (XP Pro) |
| Assigned to: | Ulf Wendel | CPU Architecture: | Any |
| Tags: | Contribution, static library build` | ||
[14 Jul 2009 9:49]
Ulf Wendel
Lawrin, I have pushed the suggested patch to trunk. It looks reasonable to me. Can you check if it works? The lastest development trunk is mirrored every couple of hours at https://code.launchpad.net/~mysql/mysql-connector-cpp/trunk , just in case anybody wants to try it out.

Description: in the build_config.h the CPPCONN_PUBLIC_FUNC is set to __declspec(dllimport), because the CPPCONN_LIB_BUILD is not defined for the static build: ---------------- // this is for static build #ifdef CPPCONN_LIB_BUILD #define CPPCONN_PUBLIC_FUNC #else // this is for clients using dynamic lib #define CPPCONN_PUBLIC_FUNC __declspec(dllimport) #endif ----------------- as the comment states the CPPCONN_LIB_BUILD should be defined for the static library. How to repeat: use the static mysqlcppconn-static.lib in a C++ project on windows. Suggested fix: In the driver/CMakeLists.txt add COMPILE_DEFINITIONS CPPCONN_LIB_BUILD="" to the SET_TARGET_PROPERTIES command for the static lib: -------------------- SET_TARGET_PROPERTIES(mysqlcppconn-static PROPERTIES LINK_FLAGS "${MYSQL_LINK_FLAGS} $ENV{LDFLAGS}" COMPILE_FLAGS "$ENV{CPPFLAGS} ${MYSQL_CXXFLAGS} $ENV{CXXFLAGS}" COMPILE_DEFINITIONS CPPCONN_LIB_BUILD="") -------------------- This worked fine for me. thanks.