MySQL :: MySQL 5.7 Reference Manual :: Compiling and Installing Plugin Libraries

MySQL :: MySQL 5.7 Reference Manual :: Compiling and Installing Plugin Libraries Contact MySQL  |  Login  |  Register The world's most popular open source database MySQL.com Downloads Documentation Developer Zone Developer Zone Downloads MySQL.com Documentation MySQL Server MySQL Enterprise Workbench Router Utilities/Fabric MySQL NDB Cluster Connectors More MySQL.com Downloads Developer Zone Section Menu:   Documentation Home MySQL 5.7 Reference Manual Preface and Legal Notices General Information Installing and Upgrading MySQL Using MySQL as a Document Store Tutorial MySQL Programs MySQL Server Administration Security Backup and Recovery Optimization Language Structure Globalization Data Types Functions and Operators SQL Statement Syntax The InnoDB Storage Engine Alternative Storage Engines High Availability and Scalability Replication MySQL NDB Cluster 7.5 Partitioning Stored Programs and Views INFORMATION_SCHEMA Tables MySQL Performance Schema MySQL sys Schema Connectors and APIs Extending MySQL MySQL Internals MySQL Threads The MySQL Test Suite The MySQL Plugin API Types of Plugins Plugin API Characteristics Plugin API Components Writing Plugins Overview of Plugin Writing Plugin Data Structures Compiling and Installing Plugin Libraries Writing Full-Text Parser Plugins Writing Daemon Plugins Writing INFORMATION_SCHEMA Plugins Writing Semisynchronous Replication Plugins Writing Audit Plugins Writing Authentication Plugins Writing Password-Validation Plugins Writing Protocol Trace Plugins Writing Keyring Plugins MySQL Services for Plugins The Locking Service The Locking Service C Interface The Locking Service UDF Interface The Keyring Service Adding New Functions to MySQL Features of the User-Defined Function Interface Adding a New User-Defined Function UDF Calling Sequences for Simple Functions UDF Calling Sequences for Aggregate Functions UDF Argument Processing UDF Return Values and Error Handling UDF Compiling and Installing UDF Security Precautions Adding a New Native Function Debugging and Porting MySQL Debugging a MySQL Server Compiling MySQL for Debugging Creating Trace Files Using WER with PDB to create a Windows crashdump Debugging mysqld under gdb Using a Stack Trace Using Server Logs to Find Causes of Errors in mysqld Making a Test Case If You Experience Table Corruption Debugging a MySQL Client The DBUG Package MySQL Enterprise Edition MySQL Workbench MySQL 5.7 Frequently Asked Questions Errors, Error Codes, and Common Problems Restrictions and Limits Indexes MySQL Glossary Related Documentation MySQL 5.7 Release Notes Download this Manual PDF (US Ltr) - 35.7Mb PDF (A4) - 35.7Mb PDF (RPM) - 34.7Mb EPUB - 8.7Mb HTML Download (TGZ) - 8.5Mb HTML Download (Zip) - 8.5Mb HTML Download (RPM) - 7.3Mb Eclipse Doc Plugin (TGZ) - 9.3Mb Eclipse Doc Plugin (Zip) - 11.5Mb Man Pages (TGZ) - 203.5Kb Man Pages (Zip) - 308.9Kb Info (Gzip) - 3.3Mb Info (Zip) - 3.3Mb Excerpts from this Manual MySQL Backup and Recovery MySQL Globalization MySQL Information Schema MySQL Installation Guide MySQL and Linux/Unix MySQL and OS X MySQL Partitioning MySQL Performance Schema MySQL Replication Using the MySQL Yum Repository MySQL Restrictions and Limitations Security in MySQL MySQL and Solaris Building MySQL from Source Starting and Stopping MySQL MySQL Tutorial MySQL and Windows MySQL Cluster NDB 7.5 version 5.7 8.0 5.6 5.5 5.6  Japanese MySQL 5.7 Reference Manual  /  ...  /  Extending MySQL  /  The MySQL Plugin API  /  Writing Plugins  /  Compiling and Installing Plugin Libraries Compiling and Installing Plugin Libraries After your plugin is written, you must compile it and install it. The procedure for compiling shared objects varies from system to system. If you build your library using CMake, it should be able to generate the correct compilation commands for your system. If the library is named somepluglib, you should end up with a shared library file that has a name something like somepluglib.so. (The .so file name suffix might differ on your system.) To use CMake, you'll need to set up the configuration files to enable the plugin to be compiled and installed. Use the plugin examples under the plugin directory of a MySQL source distribution as a guide. Create CMakeLists.txt, which should look something like this: MYSQL_ADD_PLUGIN(somepluglib somepluglib.c MODULE_ONLY MODULE_OUTPUT_NAME "somepluglib") When CMake generates the Makefile, it should take care of passing to the compilation command the -DMYSQL_DYNAMIC_PLUGIN flag, and passing to the linker the -lmysqlservices flag, which is needed to link in any functions from services provided through the plugin services interface. See Section 26.3, “MySQL Services for Plugins” . Run CMake, then run make: shell> cmake . shell> make If you need to specify configuration options to CMake, see Section 2.9.4, “MySQL Source-Configuration Options” , for a list. For example, you might want to specify CMAKE_INSTALL_PREFIX to indicate the MySQL base directory under