Bug #17117 header fille "plugin.h" does not have a namespace prefix
Submitted: 4 Feb 2006 12:04 Modified: 15 Feb 2006 20:24
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1 OS:
Assigned to: Sergey Vojtovich CPU Architecture:Any
Triage: D4 (Minor)

[4 Feb 2006 12:04] Hartmut Holzgraefe
Description:
the header file "plugin.h" is required for writing mysql plugins like fulltext parsers 
or storage engines, it is installed in the public mysql include directory

this may lead to name conflicts with plugins that make use of additional
libraries if there is another "plugin.h" in the include path

a quick search on my machine shows 13 different non-mysql plugin.h files ...

How to repeat:
.

Suggested fix:
rename it either "my_plugin.h" or "mysql_plugin.h"
[4 Feb 2006 12:11] Miguel Solorzano
Thank you for the bug report.
[6 Feb 2006 11:58] Sergei Golubchik
That's because you are expected to include it as

#include <mysql/plugin.h>
[6 Feb 2006 12:12] Hartmut Holzgraefe
i have to object for two reasons:

#1: the include path given by the mysql_config tool is

  $ mysql_config --include
  -I/usr/local/mysql-5.1/include/mysql

and not 

  -I/usr/local/mysql-5.1/include
  
so #include <mysql/plugin.h> would simply not work when using
the recommended mysql_config tool for compiler/linker flag settings

#2: it is not documented that way:

http://dev.mysql.com/doc/refman/5.1/en/plugin-creating.html

   To create a plugin library, follow these steps:

   1.  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 <my_global.h>
      #include <m_string.h>
      #include <m_ctype.h>
      #include <plugin.h>
[8 Feb 2006 18:30] Jim Winstead
The documentation is wrong, #include <mysql/plugin.h> should be used.

mysql_config should not be used for plugins. Perhaps we will have a 'mysqlxs' tool or similar in the future.
[8 Feb 2006 18:35] Hartmut Holzgraefe
Looking at 

- the documentation
- the example file plugin/fulltext/plugin_example.c
- the mnogo search plugin

i see all of them using <plugin.h>, not <mysql/plugin.h>

what is the reason for *not* using mysql_config here?
to me it is the obvious tool to use for any api we provide,
not just the plugin api ... (although it is not yet really usable
for ndbapi either ...)
[8 Feb 2006 19:15] Hartmut Holzgraefe
hardcoding the include subpath in the #include directives will also break
builds that use the --includedir configure option ...
[14 Feb 2006 9:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/2578
[14 Feb 2006 12:56] Sergey Vojtovich
Fixed in 5.1.7.

Fixed all include directives to include mysql/plugin.h in source code.
plugin.h has been moved into include/mysql/plugin.h.
[15 Feb 2006 20:24] Paul Dubois
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).

Additional info:

The example in the manual is updated to use the correct path.