From 31b79618e34a36ff24d2e1a6186258dc18e12aa5 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 10 Jun 2009 10:59:49 +0200 Subject: Backport WL#3653 to 5.1 to enable bundled innodb plugin. Remove custom DLL loader code from innodb plugin code, use symbols exported from mysqld. --- include/m_ctype.h | 6 +++--- include/my_global.h | 13 +++++++++++++ include/my_sys.h | 8 ++++---- include/mysql/plugin.h | 16 +++++++++++++--- 4 files changed, 33 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/m_ctype.h b/include/m_ctype.h index 04cf921dfee..451c8db549b 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -285,7 +285,7 @@ typedef struct charset_info_st #define ILLEGAL_CHARSET_INFO_NUMBER (~0U) -extern CHARSET_INFO my_charset_bin; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin; extern CHARSET_INFO my_charset_big5_chinese_ci; extern CHARSET_INFO my_charset_big5_bin; extern CHARSET_INFO my_charset_cp932_japanese_ci; @@ -298,7 +298,7 @@ extern CHARSET_INFO my_charset_gb2312_chinese_ci; extern CHARSET_INFO my_charset_gb2312_bin; extern CHARSET_INFO my_charset_gbk_chinese_ci; extern CHARSET_INFO my_charset_gbk_bin; -extern CHARSET_INFO my_charset_latin1; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1; extern CHARSET_INFO my_charset_latin1_german2_ci; extern CHARSET_INFO my_charset_latin1_bin; extern CHARSET_INFO my_charset_latin2_czech_ci; @@ -315,7 +315,7 @@ extern CHARSET_INFO my_charset_utf8_general_ci; extern CHARSET_INFO my_charset_utf8_unicode_ci; extern CHARSET_INFO my_charset_utf8_bin; extern CHARSET_INFO my_charset_cp1250_czech_ci; -extern CHARSET_INFO my_charset_filename; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename; /* declarations for simple charsets */ extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t, diff --git a/include/my_global.h b/include/my_global.h index 9e8c9bdfc70..996972c1411 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1573,4 +1573,17 @@ static inline double rint(double x) } #endif /* HAVE_RINT */ +/* + MYSQL_PLUGIN_IMPORT macro is used to export mysqld data + (i.e variables) for usage in storage engine loadable plugins. + Outside of Windows, it is dummy. +*/ +#ifndef MYSQL_PLUGIN_IMPORT +#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN)) +#define MYSQL_PLUGIN_IMPORT __declspec(dllimport) +#else +#define MYSQL_PLUGIN_IMPORT +#endif +#endif + #endif /* my_global_h */ diff --git a/include/my_sys.h b/include/my_sys.h index 01804cd089f..a5ebe2bb909 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -221,8 +221,8 @@ extern uint my_large_page_size; #endif /* charsets */ -extern CHARSET_INFO *default_charset_info; -extern CHARSET_INFO *all_charsets[256]; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; +extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[256]; extern CHARSET_INFO compiled_charsets[]; /* statistics */ @@ -237,8 +237,8 @@ extern void (*my_sigtstp_cleanup)(void), (*my_sigtstp_restart)(void), (*my_abort_hook)(int); /* Executed when comming from shell */ -extern int NEAR my_umask, /* Default creation mask */ - NEAR my_umask_dir, +extern MYSQL_PLUGIN_IMPORT int NEAR my_umask; /* Default creation mask */ +extern int NEAR my_umask_dir, NEAR my_recived_signals, /* Signals we have got */ NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ NEAR my_dont_interrupt; /* call remember_intr when set */ diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index a978d44b918..2e59262d061 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -16,6 +16,16 @@ #ifndef _my_plugin_h #define _my_plugin_h + +/* + On Windows, exports from DLL need to be declared +*/ +#if (defined(_WIN32) && defined(MYSQL_DYNAMIC_PLUGIN)) +#define MYSQL_PLUGIN_EXPORT extern "C" __declspec(dllexport) +#else +#define MYSQL_PLUGIN_EXPORT +#endif + #ifdef __cplusplus class THD; class Item; @@ -90,9 +100,9 @@ int PSIZE= sizeof(struct st_mysql_plugin); \ struct st_mysql_plugin DECLS[]= { #else #define __MYSQL_DECLARE_PLUGIN(NAME, VERSION, PSIZE, DECLS) \ -int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \ -int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \ -struct st_mysql_plugin _mysql_plugin_declarations_[]= { +MYSQL_PLUGIN_EXPORT int _mysql_plugin_interface_version_= MYSQL_PLUGIN_INTERFACE_VERSION; \ +MYSQL_PLUGIN_EXPORT int _mysql_sizeof_struct_st_plugin_= sizeof(struct st_mysql_plugin); \ +MYSQL_PLUGIN_EXPORT struct st_mysql_plugin _mysql_plugin_declarations_[]= { #endif #define mysql_declare_plugin(NAME) \ -- cgit v1.2.1