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 either statically or dynamically linked to the Connector/C++ libraries. Connector/C++ is usually statically linked to the underlying MySQL client library (or to Connector/C; unless otherwise stated, reference to the MySQL client library is also taken to include Connector/C, which is a separately packaged, standalone version of the MySQL client library).
As of Connector/C++ 1.1.0, it is also possible to dynamically link to the
underlying MySQL client library, although this capability is not
enabled by default. To dynamically link Connector/C++ to the client
building Connector/C++ from source:
shell> rm CMakeCache.txt shell> cmake . -DMYSQLCLIENT_STATIC_LINKING=1 shell> make clean shell> make shell> make install
Now, when creating a connection in your application, Connector/C++ will select and load a client library at runtime. It will choose 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.