List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:December 4 2008 1:33am
Subject:RE: bzr push into mysql-6.0-bugteam branch (holyfoot:2770 to 2771)
Bug#41103
View as plain text  
Hmm, somehow the number of WTFs per code line in this push is substantial as
in the last variations to this theme.

What does this do?
> +#ifdef MY_USE_CLIENT_DLL
> +char *emb_make_ftype(int type);
> +#define my_fopen(name, mode, flags) fopen(name, emb_make_ftype(mode))
> +#define my_fclose(file, flags) fclose(file)
> +#endif /*MY_USE_CLIENT_DLL*/

Seriously, I consider  the idea  of exporting symbols from libmysqld.dll
unrelated to the API itself (e.g _dig_vec_upper)a failure. Visual C++ is not
GCC and does not export all symbols from shared library and attempts to make
it so are doomed:) Even if it was technically possible on the 4th attempt,
after  this http://lists.mysql.com/commits/60501, and
http://lists.mysql.com/commits/60271, and
http://lists.mysql.com/commits/55214 , I admit the method is intrusive and
does not contribute to readability.

The original problem in  Bug #38293 was not that "application built upon
this library shouldn't link these libraries to itself, rather use those
inside the dll", but a crash , and the reason for the crash was somewhere
else.
And the reason was fixed in Bug#38522. 

Any objections if I push that while reverting the patches above - lets think
of them as nice but failed experiment;)

CCing joro as lead, davi, because he was interested , and monty, because he
reviewed the original patch for Bug #38293.


Wlad

> -----Original Message-----
> From: Alexey Botchkov [mailto:holyfoot@stripped]
> Sent: Wednesday, December 03, 2008 3:11 PM
> To: commits@stripped
> Subject: bzr push into mysql-6.0-bugteam branch (holyfoot:2770 to 2771)
> Bug#41103
> 
>  2771 Alexey Botchkov	2008-12-03
>       Bug #41103 6.0 Windows embedded-server tests fail
>       to be exported correctly from the DLL, data
>                 has to be declared as __declspec(dllimport)
>                 for the client, and as DATA in the .def file.
> 
>             per-file comments:
>               include/m_string.h
>             Bug#41103 6.0 Windows embedded-server tests fail
>                 __declspec(dllimport) added for Windows
>               include/my_global.h
>             Bug#41103 6.0 Windows embedded-server tests fail
>                 __declspec(dllimport) added for Windows
>               include/my_sys.h
>             Bug#41103 6.0 Windows embedded-server tests fail
>                 __declspec(dllimport) added for Windows
>               libmysql/libmysql.def
>             Bug#41103 6.0 Windows embedded-server tests fail
>                DATA modifiers added
>               libmysqld/examples/CMakeLists.txt
>             Bug#41103 6.0 Windows embedded-server tests fail
>                MY_USE_CLIENT_DLL defined for projects
>               libmysqld/libmysqld.def
>             Bug#41103 6.0 Windows embedded-server tests fail
>                DATA modifiers added
> 
>       per-file comments:
>         include/m_string.h
>         include/my_global.h
>         include/my_sys.h
>         libmysql/libmysql.def
>         libmysqld/examples/CMakeLists.txt
>         libmysqld/libmysqld.def
> modified:
>   client/mysqltest.c
>   include/m_ctype.h
>   include/m_string.h
>   include/my_global.h
>   include/my_sys.h
>   include/mysql.h
>   libmysql/libmysql.def
>   libmysqld/examples/CMakeLists.txt
>   libmysqld/libmysqld.c
>   libmysqld/libmysqld.def
>   mysys/my_fopen.c
> 
>  2770 Georgi Kodinov	2008-12-02 [merge]
>       merged 5.1-bugteam -> 6.0-bugteam
> modified:
>   extra/yassl/src/yassl_imp.cpp
>   sql/set_var.h
> 
> === modified file 'client/mysqltest.c'
> --- a/client/mysqltest.c	2008-11-03 17:51:36 +0000
> +++ b/client/mysqltest.c	2008-12-03 14:05:31 +0000
> @@ -147,7 +147,7 @@ static struct st_test_file* cur_file;
>  static struct st_test_file* file_stack_end;
> 
> 
> -static CHARSET_INFO *charset_info= &my_charset_latin1; /* Default
> charset */
> +static CHARSET_INFO *charset_info; /* Default charset */
> 
>  static const char *embedded_server_groups[]=
>  {
> @@ -7255,6 +7255,7 @@ int main(int argc, char **argv)
>    MY_STAT res_info;
>    MY_INIT(argv[0]);
> 
> +  charset_info= &my_charset_latin1;
>    save_file[0]= 0;
>    TMPDIR[0]= 0;
> 
> 
> === modified file 'include/m_ctype.h'
> --- a/include/m_ctype.h	2008-07-23 09:43:50 +0000
> +++ b/include/m_ctype.h	2008-12-03 14:05:31 +0000
> @@ -321,7 +321,7 @@ typedef struct charset_info_st
>  #define ILLEGAL_CHARSET_INFO_NUMBER (~0U)
> 
> 
> -extern CHARSET_INFO my_charset_bin;
> +MY_DLLEXPORT 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;
> @@ -336,7 +336,7 @@ extern CHARSET_INFO my_charset_gb2312_ch
>  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;
> +MY_DLLEXPORT 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;
> 
> === modified file 'include/m_string.h'
> --- a/include/m_string.h	2008-06-26 18:29:30 +0000
> +++ b/include/m_string.h	2008-12-03 14:05:31 +0000
> @@ -89,8 +89,8 @@ extern char *stpcpy(char *, const char *
>  #endif
> 
>  /* Declared in int2str() */
> -extern char NEAR _dig_vec_upper[];
> -extern char NEAR _dig_vec_lower[];
> +MY_DLLEXPORT char NEAR _dig_vec_upper[];
> +MY_DLLEXPORT char NEAR _dig_vec_lower[];
> 
>  #ifdef BAD_STRING_COMPILER
>  #define strmov(A,B)  (memccpy(A,B,0,INT_MAX)-1)
> 
> === modified file 'include/my_global.h'
> --- a/include/my_global.h	2008-11-19 10:04:44 +0000
> +++ b/include/my_global.h	2008-12-03 14:05:31 +0000
> @@ -1615,4 +1615,10 @@ inline void  operator delete[](void*, vo
>  #  define __func__ "<unknown>"
>  #endif
> 
> +#ifdef MY_USE_CLIENT_DLL
> +#define MY_DLLEXPORT __declspec(dllimport)
> +#else
> +#define MY_DLLEXPORT extern
> +#endif /*MY_USE_CLIENT_DLL*/
> +
>  #endif /* my_global_h */
> 
> === modified file 'include/my_sys.h'
> --- a/include/my_sys.h	2008-10-20 19:13:22 +0000
> +++ b/include/my_sys.h	2008-12-03 14:05:31 +0000
> @@ -218,7 +218,7 @@ extern int errno;			/* declare errno
> */
>  #endif					/* #ifndef errno */
>  extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
>  extern char *home_dir;			/* Home directory for user
*/
> -extern const char *my_progname;		/* program-name (printed in
> errors) */
> +MY_DLLEXPORT const char *my_progname;		/* program-name
> (printed in errors) */
>  extern const char *my_progname_short;	/* like above but without
> directory */
>  extern char NEAR curr_dir[];		/* Current directory for user */
>  extern void (*error_handler_hook)(uint my_err, const char *str,myf
> MyFlags);
> @@ -682,6 +682,7 @@ extern void     my_osmaperr(unsigned lon
>  extern void TERMINATE(FILE *file, uint flag);
>  #endif
>  extern void init_glob_errs(void);
> +extern void make_ftype(char * to,int flag);
>  extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
>  extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf
> MyFlags);
>  extern int my_fclose(FILE *fd,myf MyFlags);
> 
> === modified file 'include/mysql.h'
> --- a/include/mysql.h	2008-08-07 17:52:43 +0000
> +++ b/include/mysql.h	2008-12-03 14:05:31 +0000
> @@ -748,6 +748,12 @@ int		STDCALL mysql_drop_db(MYSQL *mysql,
>  #pragma pack(pop)		/* restore alignment */
>  #endif
> 
> +#ifdef MY_USE_CLIENT_DLL
> +char *emb_make_ftype(int type);
> +#define my_fopen(name, mode, flags) fopen(name, emb_make_ftype(mode))
> +#define my_fclose(file, flags) fclose(file)
> +#endif /*MY_USE_CLIENT_DLL*/
> +
>  #ifdef	__cplusplus
>  }
>  #endif
> 
> === modified file 'libmysql/libmysql.def'
> --- a/libmysql/libmysql.def	2008-08-11 10:03:45 +0000
> +++ b/libmysql/libmysql.def	2008-12-03 14:05:31 +0000
> @@ -1,8 +1,9 @@
>  LIBRARY		LIBMYSQL
>  VERSION		6.0
>  EXPORTS
> -	_dig_vec_lower
> -	_dig_vec_upper
> +	_dig_vec_lower DATA
> +	_dig_vec_upper DATA
> +        my_progname DATA
>  	bmove_upp
>  	delete_dynamic
>  	free_defaults
> 
> === modified file 'libmysqld/examples/CMakeLists.txt'
> --- a/libmysqld/examples/CMakeLists.txt	2008-11-19 12:11:30 +0000
> +++ b/libmysqld/examples/CMakeLists.txt	2008-12-03 14:05:31 +0000
> @@ -24,18 +24,18 @@ IF(WIN32)
>    ADD_DEFINITIONS(-DUSE_TLS)
>  ENDIF(WIN32)
> 
> -ADD_DEFINITIONS(-DEMBEDDED_LIBRARY)
> +ADD_DEFINITIONS(-DEMBEDDED_LIBRARY -DMY_USE_CLIENT_DLL)
> 
>  ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc
>                 ../../client/mysql.cc ../../client/readline.cc
>                 ../../client/sql_string.cc)
> -TARGET_LINK_LIBRARIES(mysql_embedded ws2_32)
> +TARGET_LINK_LIBRARIES(mysql_embedded)
>  ADD_DEPENDENCIES(mysql_embedded libmysqld)
> 
>  ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.c)
> -TARGET_LINK_LIBRARIES(mysqltest_embedded ws2_32)
> +TARGET_LINK_LIBRARIES(mysqltest_embedded)
>  ADD_DEPENDENCIES(mysqltest_embedded libmysqld)
> 
>  ADD_EXECUTABLE(mysql_client_test_embedded
> ../../tests/mysql_client_test.c)
> -TARGET_LINK_LIBRARIES(mysql_client_test_embedded ws2_32)
> +TARGET_LINK_LIBRARIES(mysql_client_test_embedded)
>  ADD_DEPENDENCIES(mysql_client_test_embedded libmysqld)
> 
> === modified file 'libmysqld/libmysqld.c'
> --- a/libmysqld/libmysqld.c	2008-10-17 15:11:28 +0000
> +++ b/libmysqld/libmysqld.c	2008-12-03 14:05:31 +0000
> @@ -223,3 +223,14 @@ error:
>    DBUG_RETURN(0);
>  }
> 
> +
> +#ifdef __WIN__
> +static char emb_makeftype_buffer[10];
> +
> +char *emb_make_ftype(int type)
> +{
> +  make_ftype(emb_makeftype_buffer, type);
> +  return emb_makeftype_buffer;
> +}
> +#endif /*__WIN__*/
> +
> 
> === modified file 'libmysqld/libmysqld.def'
> --- a/libmysqld/libmysqld.def	2008-11-26 11:54:39 +0000
> +++ b/libmysqld/libmysqld.def	2008-12-03 14:05:31 +0000
> @@ -44,7 +44,7 @@ EXPORTS
>  	pthread_create
>  	pthread_cond_init
>  	ll2str
> -	my_fileno
> +        my_fileno
>  	my_gcvt
>  	my_regcomp
>  	my_regexec
> @@ -63,8 +63,8 @@ EXPORTS
>  	my_dir
>  	my_micro_time
>  	find_type_or_exit
> -	_dig_vec_upper
> -	_dig_vec_lower
> +	_dig_vec_upper DATA
> +	_dig_vec_lower DATA
>  	bmove_upp
>  	delete_dynamic
>  	free_defaults
> @@ -177,17 +177,18 @@ EXPORTS
>  	mysql_sqlstate
>  	charsets_dir
>  	disabled_my_option
> -	my_charset_latin1
> +	my_charset_latin1 DATA
> +	my_charset_bin DATA
> +	my_charset_same
>  	init_alloc_root
> -	my_progname
> +	my_progname DATA
>  	get_charset_name
>  	get_charset_by_csname
>  	print_defaults
>  	find_type
>  	strxnmov
>  	strend
> -	my_fopen
> -	my_fclose
> +        emb_make_ftype
>  	unpack_filename
>  	str2int
>  	int10_to_str
> @@ -228,7 +229,5 @@ EXPORTS
>  	mysql_stmt_attr_set
>  	mysql_stmt_field_count
>  	get_defaults_options
> -	my_charset_bin
> -	my_charset_same
>  	modify_defaults_file
>          mysql_stmt_next_result
> 
> === modified file 'mysys/my_fopen.c'
> --- a/mysys/my_fopen.c	2008-07-23 08:52:08 +0000
> +++ b/mysys/my_fopen.c	2008-12-03 14:05:31 +0000
> @@ -18,7 +18,6 @@
>  #include <errno.h>
>  #include "mysys_err.h"
> 
> -static void make_ftype(char * to,int flag);
> 
>  /*
>    Open a file as stream
> @@ -196,7 +195,7 @@ FILE *my_fdopen(File Filedes, const char
>      a+ == O_RDWR|O_APPEND|O_CREAT
>  */
> 
> -static void make_ftype(register char * to, register int flag)
> +void make_ftype(register char * to, register int flag)
>  {
>    /* check some possible invalid combinations */
>    DBUG_ASSERT((flag & (O_TRUNC | O_APPEND)) != (O_TRUNC | O_APPEND));
> 
> 
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:
> http://lists.mysql.com/commits?unsub=1


Thread
bzr push into mysql-6.0-bugteam branch (holyfoot:2770 to 2771) Bug#41103Alexey Botchkov3 Dec
  • RE: bzr push into mysql-6.0-bugteam branch (holyfoot:2770 to 2771)Bug#41103Vladislav Vaintroub4 Dec