Search code examples
c++mysqlwindowsplugins

MySQL plugin architecture


When loading a MySQL plugin on Windows 10 (using the MySQL shell), only the DLL name needs to be specified, as in the following example:

INSTALL PLUGIN daemon_example SONAME ‘libdaemon_example.dll’;

As there is no requirement to reference the associated import lib (.lib) file, I figured that there had to be GetProcAddress() and LoadLibrary() calls in the MySQL source for Windows. However, I did not find these calls in the source.

Could someone enlighten me on how plugin loading is accomplished in MySQL?


Solution

  • Ref: Updated link: 4.4.1 Overview of Plugin Writing

    Also: A higher level starting point: Chapter 4 The MySQL Plugin API

    28.2.4.1 Overview of Plugin Writing

    1. In the plugin source file, include the header files that the plugin library needs. The plugin.h file is required, and the library might require other files as well. For example:

      #include <stdlib.h>
      #include <ctype.h>
      #include <mysql/plugin.h>

    2. Set up the descriptor information for the plugin library file. For server plugins, write the library descriptor, which must contain the general plugin descriptor for each server plugin in the file. For more information, see Section 28.2.4.2.1, “Server Plugin Library and Plugin Descriptors”. In addition, set up the type-specific descriptor for each server plugin in the library. Each plugin's general descriptor points to its type-specific descriptor.

    For client plugins, write the client descriptor. For more information, see Section 28.2.4.2.3, “Client Plugin Descriptors”.

    1. Write the plugin interface functions for each plugin. For example, each plugin's general plugin descriptor points to the initialization and deinitialization functions that the server should invoke when it loads and unloads the plugin. The plugin's type-specific description may also point to interface functions.

    2. For server plugins, set up the status and system variables, if there are any.

    3. Compile the plugin library as a shared library and install it in the plugin directory. For more information, see Section 28.2.4.3, “Compiling and Installing Plugin Libraries”.

    4. For server plugins, register the plugin with the server. For more information, see Section 5.6.1, “Installing and Uninstalling Plugins”.

    5. Test the plugin to verify that it works properly.

    Ref. https://yandex.ru/search/?text=MySQL%205%20Plugin%20Development%20buy

    Also: