Documentation Home
MySQL Connector/C++ Developer Guide
Related Documentation Download this Manual
PDF (US Ltr) - 249.3Kb
PDF (A4) - 252.8Kb
HTML Download (TGZ) - 52.5Kb
HTML Download (Zip) - 66.8Kb


MySQL Connector/C++ Developer Guide  /  Installing Connector/C++ from Source  /  Dynamically Linking Connector/C++ Against the MySQL Client Library

4.5 Dynamically Linking Connector/C++ Against the MySQL Client Library

Note

This section refers to dynamic linking of Connector/C++ to the client library, not dynamic linking of applications to Connector/C++. Precompiled binaries of Connector/C++ use static binding with the client library by default.

An application that uses Connector/C++ can be linked either statically or dynamically to the Connector/C++ libraries. Connector/C++ is usually linked statically to the underlying MySQL client library.

It is also possible to link dynamically to the underlying MySQL client library, although this capability is not enabled by default. To link Connector/C++ dynamically to the client library, disable MYSQLCLIENT_STATIC_LINKING when building Connector/C++ from source:

rm CMakeCache.txt
cmake . -DMYSQLCLIENT_STATIC_LINKING=0
make clean
make
make install

Now, when creating a connection in your application, Connector/C++ selects and loads a client library at runtime. It chooses the client library by searching defined locations and environment variables depending on the host operating system. It is also possible when creating a connection in an application to define an absolute path to the client library to load at runtime. This can be convenient if you have defined a standard location from which you want the client library to be loaded. This is sometimes done to circumvent possible conflicts with other versions of the client library that may be located on the system.


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
Sign Up Login You must be logged in to post a comment.