MYSQL development is performed using LCCWIN32.
Current Author: Wang Meng (HeartIcy@163.com) Creation Date: January 1, 2006 Revision: 1.2
Correction Description: 1 Small modification for the current version of LCCWIN32 and MySQL
I am a student, maybe this life is always a student. Because I never thought that I will become a generation of masters! ! ^^ || For this reason I am a student, I need to pick a free compiler that supports intact and easy access to standards. LCCWIN32 has very high support for standards, and the scalability is also very strong. Usually follow the development libraries written by the C89 or C99 standard, the header file part is basically no modification, as long as the format of the library file (.lib) can be used.
I will demonstrate how to develop MYSQL through LCCWIN32 through a simple example. The focus is not the code portion, but the compiler's configuration LCCWIN32 itself's IDE editor part of the Chinese support is equal to 0, and there is a bug on the header file reference path setting, we have to handle it! This is also the importance I think it is written. (I never think that what is the article I wrote, I still have no component. ^^ ||)
MySQL.h in MySQL 5.0.18 needs to comment out 473 lines in MySQL.H
ENUM mysql_rpl_type stdcall mysql_rpl_query_type (const char *
Change to
// enum mysql_rpl_type stdcall mysql_rpl_query_type (const char *
Just mentioned that the LCCWIN32 editor has bugs, we need to manually modify the Makefile file generated by the compiler, otherwise it will not be compiled at all.
Suppose you are using the default path, then the Makefile file that the LCCWIN32 editor should contain similar subsections:
Cflags = -i "c: / lcc / incrude" -o -p6 -unused -ansic
If we add a multi-head file reference directly from the editor, we generate an error, so we hand-add the path to this form:
Cflags = -i "c: / lcc / incrude" -i "c: / mysql / incrude" -o -p6 -unused -ansic
OK! The first problem header file is resolved.
Now let's start to solve the next problem library file (.lib). Windows's MySQL library files are compiled with VC5, and we must first use the library conversion tool included with the LCCWIN32. After the conversion, the LCCWIN32 can normally identify this library file. Then the important problem is how we introduce the library file. In LCCWIN32, we can use two methods. The first method is to knock in the library name from the editor's library bouting; another is to use the compiler's preparational command #pragma lib "library". I recommend the second type, because we need the DEBUG version of the library file in the development process, in the actual issuance, in the actual issuance, we need to generate the final release file with the OPT version, which is directly set in the editor in the environment of the LCCWIN32. unwise!
Now we solve the reference to the header file and the library file, there is no problem. A simple example is as follows:
#pragma lib
Mysql * mydata;
INT Main (int Argc, char * argv []) {char userid [20]; struffpy (userid, "root"); // account char password [20]; strcpy (password, "); // password char host [20]; strcpy (host, "localhost"); // host char dbname [10]; STRCPY (DBNAME, "TEST"); // Database IF ((MYDATA = mysql_init ((MySQL *) 0) && mysql_real_connect MYDATA, HOST, Userid, Password, DBNAME, MYSQL_PORT, NULL, 0)) PRINTF ("MySQL Ready / N"); ElseExit (0); mysql_close (mydata); Return 1;}
If fully in accordance with this article, a 3.03 kB or 13.03 kb (Debuger) can be generated. By the way, I don't know if there is still a volume of executable than the spell. The mysql official routine is compiled with LCCWIN32, which is only 1/5 of the executable file generated by the VC!
** Applicable range mysql 3.23.x or more (www.mysql.com) ** LCCWIN32 3.2 or more (http://www.q-software-solutions.de/products/lcc-win32/)
** If you have any questions, you can discuss it with me through email health@163.com. good luck!
** This document Follow the US Free Software Foundation General Document License Agreement Released **