Skip to content

Commit 69f1a32

Browse files
committed
Replace dynamic loading of mysqld.exe data for plugins, replace with MYSQL_PLUGIN_IMPORT
1 parent 911af69 commit 69f1a32

File tree

8 files changed

+12
-62
lines changed

8 files changed

+12
-62
lines changed

include/m_ctype.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ extern struct charset_info_st my_charset_utf16le_general_ci;
516516
extern struct charset_info_st my_charset_utf32_bin;
517517
extern struct charset_info_st my_charset_utf32_general_ci;
518518
extern struct charset_info_st my_charset_utf32_unicode_ci;
519-
extern struct charset_info_st my_charset_utf8_bin;
519+
extern struct charset_info_st MYSQL_PLUGIN_IMPORT my_charset_utf8_bin;
520520
extern struct charset_info_st my_charset_utf8_general_mysql500_ci;
521521
extern struct charset_info_st my_charset_utf8_unicode_ci;
522522
extern struct charset_info_st my_charset_utf8mb4_bin;

include/my_default.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
C_MODE_START
2222

23-
extern const char *my_defaults_extra_file;
23+
extern MYSQL_PLUGIN_IMPORT const char *my_defaults_extra_file;
2424
extern const char *my_defaults_group_suffix;
25-
extern const char *my_defaults_file;
25+
extern MYSQL_PLUGIN_IMPORT const char *my_defaults_file;
2626
extern my_bool my_getopt_use_args_separator;
2727
extern my_bool my_getopt_is_args_separator(const char* arg);
2828

sql/mysqld.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ extern bool opt_disable_networking, opt_skip_show_db;
9292
extern bool opt_skip_name_resolve;
9393
extern bool opt_ignore_builtin_innodb;
9494
extern my_bool opt_character_set_client_handshake;
95-
extern bool volatile abort_loop;
95+
extern MYSQL_PLUGIN_IMPORT bool volatile abort_loop;
9696
extern bool in_bootstrap;
9797
extern uint connection_count;
9898
extern my_bool opt_safe_user_create;
@@ -155,7 +155,7 @@ extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
155155
extern const double log_10[309];
156156
extern ulonglong keybuff_size;
157157
extern ulonglong thd_startup_options;
158-
extern ulong thread_id;
158+
extern MYSQL_PLUGIN_IMPORT ulong thread_id;
159159
extern ulong binlog_cache_use, binlog_cache_disk_use;
160160
extern ulong binlog_stmt_cache_use, binlog_stmt_cache_disk_use;
161161
extern ulong aborted_threads,aborted_connects;
@@ -226,7 +226,7 @@ extern MYSQL_FILE *bootstrap_file;
226226
extern my_bool old_mode;
227227
extern LEX_STRING opt_init_connect, opt_init_slave;
228228
extern int bootstrap_error;
229-
extern I_List<THD> threads;
229+
extern MYSQL_PLUGIN_IMPORT I_List<THD> threads;
230230
extern char err_shared_dir[];
231231
extern ulong connection_errors_select;
232232
extern ulong connection_errors_accept;

sql/slave.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void slave_output_error_info(rpl_group_info *rgi, THD *thd);
244244
pthread_handler_t handle_slave_sql(void *arg);
245245
bool net_request_file(NET* net, const char* fname);
246246

247-
extern bool volatile abort_loop;
247+
extern MYSQL_PLUGIN_IMPORT bool volatile abort_loop;
248248
extern Master_info *active_mi; /* active_mi for multi-master */
249249
extern Master_info *default_master_info; /* To replace active_mi */
250250
extern Master_info_index *master_info_index;
@@ -258,7 +258,7 @@ extern uint report_port;
258258
extern char *master_info_file, *report_user;
259259
extern char *report_host, *report_password;
260260

261-
extern I_List<THD> threads;
261+
extern MYSQL_PLUGIN_IMPORT I_List<THD> threads;
262262

263263
#else
264264
#define close_active_mi() /* no-op */

sql/sql_class.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,8 @@ typedef struct st_xid_state {
10941094
uint rm_error;
10951095
} XID_STATE;
10961096

1097-
extern mysql_mutex_t LOCK_xid_cache;
1098-
extern HASH xid_cache;
1097+
extern MYSQL_PLUGIN_IMPORT mysql_mutex_t LOCK_xid_cache;
1098+
extern MYSQL_PLUGIN_IMPORT HASH xid_cache;
10991099
bool xid_cache_init(void);
11001100
void xid_cache_free(void);
11011101
XID_STATE *xid_cache_search(XID *xid);

sql/sql_plugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ typedef int (*plugin_type_init)(struct st_plugin_int *);
153153

154154
extern I_List<i_string> *opt_plugin_load_list_ptr;
155155
extern char *opt_plugin_dir_ptr;
156-
extern char opt_plugin_dir[FN_REFLEN];
156+
extern MYSQL_PLUGIN_IMPORT char opt_plugin_dir[FN_REFLEN];
157157
extern const LEX_STRING plugin_type_names[];
158158
extern ulong plugin_maturity;
159159
extern TYPELIB plugin_maturity_values;

storage/connect/mycat.cc

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info);
105105
/***********************************************************************/
106106
char *GetPluginDir(void)
107107
{
108-
char *plugin_dir;
109-
110-
#if defined(_WIN64)
111-
plugin_dir = (char *)GetProcAddress(GetModuleHandle(NULL),
112-
"?opt_plugin_dir@@3PADEA");
113-
#elif defined(_WIN32)
114-
plugin_dir = (char*)GetProcAddress(GetModuleHandle(NULL),
115-
"?opt_plugin_dir@@3PADA");
116-
#else
117-
plugin_dir = opt_plugin_dir;
118-
#endif
119-
120-
return plugin_dir;
108+
return opt_plugin_dir;
121109
} // end of GetPluginDir
122110

123111
/***********************************************************************/

storage/spider/spd_table.cc

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6325,43 +6325,6 @@ int spider_db_init(
63256325
memset(&spider_alloc_mem_count, 0, sizeof(spider_alloc_mem_count));
63266326
memset(&spider_free_mem_count, 0, sizeof(spider_free_mem_count));
63276327

6328-
#ifdef _WIN32
6329-
HMODULE current_module = GetModuleHandle(NULL);
6330-
spd_db_att_thread_id = (ulong *)
6331-
GetProcAddress(current_module, "?thread_id@@3KA");
6332-
#ifdef SPIDER_XID_USES_xid_cache_iterate
6333-
#else
6334-
#ifdef XID_CACHE_IS_SPLITTED
6335-
spd_db_att_xid_cache_split_num = (uint *)
6336-
GetProcAddress(current_module,
6337-
"?opt_xid_cache_split_num@@3IA");
6338-
spd_db_att_LOCK_xid_cache = *((pthread_mutex_t **)
6339-
GetProcAddress(current_module,
6340-
"?LOCK_xid_cache@@3PAUst_mysql_mutex@@A"));
6341-
spd_db_att_xid_cache = *((HASH **)
6342-
GetProcAddress(current_module, "?xid_cache@@3PAUst_hash@@A"));
6343-
#else
6344-
spd_db_att_LOCK_xid_cache = (pthread_mutex_t *)
6345-
#if MYSQL_VERSION_ID < 50500
6346-
GetProcAddress(current_module,
6347-
"?LOCK_xid_cache@@3U_RTL_CRITICAL_SECTION@@A");
6348-
#else
6349-
GetProcAddress(current_module,
6350-
"?LOCK_xid_cache@@3Ust_mysql_mutex@@A");
6351-
#endif
6352-
spd_db_att_xid_cache = (HASH *)
6353-
GetProcAddress(current_module, "?xid_cache@@3Ust_hash@@A");
6354-
#endif
6355-
#endif
6356-
spd_charset_utf8_bin = (struct charset_info_st *)
6357-
GetProcAddress(current_module, "my_charset_utf8_bin");
6358-
spd_defaults_extra_file = (const char **)
6359-
GetProcAddress(current_module, "my_defaults_extra_file");
6360-
spd_defaults_file = (const char **)
6361-
GetProcAddress(current_module, "my_defaults_file");
6362-
spd_abort_loop = (bool volatile *)
6363-
GetProcAddress(current_module, "?abort_loop@@3_NC");
6364-
#else
63656328
spd_db_att_thread_id = &thread_id;
63666329
#ifdef SPIDER_XID_USES_xid_cache_iterate
63676330
#else
@@ -6378,7 +6341,6 @@ int spider_db_init(
63786341
spd_defaults_extra_file = &my_defaults_extra_file;
63796342
spd_defaults_file = &my_defaults_file;
63806343
spd_abort_loop = &abort_loop;
6381-
#endif
63826344

63836345
#ifdef HAVE_PSI_INTERFACE
63846346
init_spider_psi_keys();

0 commit comments

Comments
 (0)