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 Connector/C). Note that, 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. Enabling dynamic linking is done through a compile-time option when compiling the Connector/C++ source code.
To dynamically link Connector/C++ to the client library, enable
cmake -DMYSQLCLIENT_STATIC_LINKING=1 .shell>
Now, in your application, when creating a connection, 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 be loaded 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.