MySQL Internals Manual  /  ...  /  Plugin Services Components

5.7.1 Plugin Services Components

On the plugin side of the services interface, the relevant information is provided in a set of header files. A plugin accesses this information by including the plugin.h file (which plugins must include anyway):

#include <mysql/plugin.h>

plugin.h includes the services.h file, which acts as an “umbrella” file that includes the service-specific headers with names of the form service_xxx.h. Within a MySQL source distribution, the header files are located in the include/mysql directory and have an inclusion hierarchy like this:

  • plugin.h includes services.h.

  • services.h is the “umbrella” header that includes all available service-specific header files.

  • Service-specific headers have names like service_my_snprintf.h or service_thd_alloc.h.

The server side of the services interface uses the header files just listed, but also involves other files. Within a MySQL source distribution, these files are located in the libservices and sql directories:

The libservices directory contains the source files from which the libmysqlservices library is built. Files in this directory include:

  • HOWTO : Instructions for writing plugin services.

  • xxx_services.h : Service-specific interface files.

During the MySQL build and install process, the libmysqlservices library is compiled and installed in a directory where plugins can access it. All plugins should link in this library using the -lmysqlservices flag when they are built.

The sql directory contains, which implements plugin functionality. This file includes sql_plugin_services.h, where each available service is registered.