← Back to team overview

maria-developers team mailing list archive

Re: [Commits] Rev 2955: Fix compiling on Windows. in file:///H:/bzr/mwl192/

 


> -----Original Message-----
> From: Kristian Nielsen [mailto:knielsen@xxxxxxxxxxxxxxx]
> Sent: Mittwoch, 6. Juli 2011 11:21
> To: maria-developers@xxxxxxxxxxxxxxxxxxx; Vladislav Vaintroub
> Subject: Re: [Commits] Rev 2955: Fix compiling on Windows. in
> file:///H:/bzr/mwl192/
> 

Hi Kristian,

> All the changes are good, but I would like your help to understand a
couple of
> them:
> 
> > === modified file 'client/async_example.c'
> > --- a/client/async_example.c	2011-06-14 09:11:47 +0000
> > +++ b/client/async_example.c	2011-06-22 14:38:52 +0000
> > @@ -17,8 +17,6 @@
> >    along with this.  If not, see <http://www.gnu.org/licenses/>.
> >  */
> >
> > -#include <stdlib.h>
> > -#include <stdio.h>
> >
> >  #ifndef __WIN__
> >  #include <poll.h>
> > @@ -26,10 +24,9 @@
> >  #include <WinSock2.h>
> >  #endif
> >
> > -/* For some reason, mysql.h does not work here on Windows, but
> client_priv.h does.
> > +#include <stdlib.h>
> > +#include <stdio.h>
> >  #include <mysql.h>
> > -*/
> > -#include <client_priv.h>
> >
> >  #define SL(s) (s), sizeof(s)
> 
> Why does this patch fix the problem? I guess the real question is what did
I
> do wrong originally? Is it that it is incorrect on windows to include
stdlib.h
> / stdio.h before Winsock2.h ?

Winsock2.h should be included first, or  IIRC some magic  macro
(WIN32_LEAN_AND_MEAN, something like that) should be defined.  This prevents
windows.h which is indirectly included by everything (for example stdio.h
and stdlib.h) to pull  also  winsock.h . winsock.h and winsock2.h have
conflicting definitions. This feature/bug has been like this in the Windows
SDK for ages, I do not know why it is not fixed yet (winsock.h is quite old
and very obsolete, I do not think anyone is using it now)


> > === modified file 'include/typelib.h'
> > --- a/include/typelib.h	2009-03-12 22:27:35 +0000
> > +++ b/include/typelib.h	2011-06-22 14:38:52 +0000
> > @@ -29,7 +29,7 @@
> >  extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int
> *error_position);
> >  extern int find_type_with_warning(const char *x, TYPELIB *typelib,
> >                                    const char *option);
> > -extern uint find_type_or_exit(const char *x, TYPELIB *typelib,
> > +extern unsigned int find_type_or_exit(const char *x, TYPELIB *typelib,
> >                                const char *option);
> >  extern int find_type(char *x, const TYPELIB *typelib, unsigned int
> full_name);
> >  extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
> 
> I do not understand what this patch has to do with my MWL#192 changes,
> can you
> help explain? (Again, I think the change is correct, I just would like to
> understand what I did to make this change necessary).

Typelib.h is included by mysql.h.  There is no uchar on Windows, which makes
source file not compile, if my_global.h not included (e.g only mysql.h is
used) .  In the last years, I keep fixing "uchar"  in public headers in
different versions of MySQL,  but it still pops up here and there again.
Specifically here, fix needed to be done so my changes above would work, I
removed client_priv.h dependency from async_sample.c, that was for Windows
only and commented as "For some reason, mysql.h does not work here" . Since
I knew the reason, why it does not work,  I removed the comment,  the
#include client_priv.h and fixed the header.

>  - Kristian.



Follow ups

References