Search code examples
mysqlwindowsmysql-5.6plugins

How to compile MySQL example plugin in Windows


I need to compile fulltext parser plugin in windows, but I am not able to dot it even with original MySQL source example. MySQL Server version is 5.6 x64. With gcc I tried variations of:

 gcc -shared -Wall -g -o "plugin_example.dll" -fPIC "plugin_example.c" -DMYSQL_DYNAMIC_PLUGIN -lmysqlservices

but when I try to install it

 INSTALL PLUGIN simple_parser SONAME 'plugin_example.dll'

I get following error

 Can't open shared library '... plugin_example.dll' (errno: 193 )

With Dev-C and its (stripped -L libs)

gcc.exe -c projekt3.c -o projekt3.o -DMYSQL_DYNAMIC_PLUGIN -DBUILDING_DLL=1
dllwrap.exe --output-def libProjekt3.def --implib libProjekt3.a projekt3.o  -static-libgcc -lmysqlservices --no-export-all-symbols --add-stdcall-alias -o Projekt3.dll

I get 250K DLL and

Can't find symbol '_mysql_plugin_interface_version_' in library

Five days of googling a trial-erroring leads me nowhere. Any help would be appreciated.


Solution

  • errno 193 means wrong file format.
    Probably there is an inconsistency between your 64 bit MySQL and the .dll. Most of the the pages from Google are talking about incompatible 32-bit and 64-bit Java versions.
    So I recommend either trying with a 32-bit MySQL, compiling the plugin for 64-bit or checking if the install routine has some assumptions about 64 or 32 bits ?