Bug #5661 Can't compile statically in BCB6 when using libmysql
Submitted: 20 Sep 2004 9:55 Modified: 1 Oct 2004 21:55
Reporter: Marcin Lewandowski Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.21 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[20 Sep 2004 9:55] Marcin Lewandowski
Description:
It is possible to create an application in Borland C++ Builder 6 using libmysql.dll - you must convert *.lib files using coff2omf. But if you want to compile application statically, there's no problem with compliation but application won't start (with error about "MYSQLCLIENT" library not found - not "mysqlclient.lib" or "libmysql.dll" - it's searching for "MYSQLCLIENT").

How to repeat:
1. Create directory
2. Copy *.lib files from MySQL distribution to dir, then convert them using coff2omf
3. Copy *.h files from include/ from MySQL distribution to dir.
4. Copy myTest.c from MySQL example test program to dir.
5. Open myTest.c in BCB6. When asked for creating project, say yes
6. Add *.lib files to project
7. In myTest.c change

#include <mysql.h>

to

#include        "winsock.h"
#include	"mysql.h"

8. Save project.
9. Here you can build project and successfully run it
10. Disable runtime library functions: Deselect Project->Options->Linker->Use Dynamic RTL and Project->Options->Packages->Build with runtime packages
11. Build project and try to run it.

Suggested fix:
I don't know how to fix it. I'd tried to compile libmysql in BCB6 from sources, to check, whether this may work, but source of MySQL 4.0.21 won't compile under BCB6.
[1 Oct 2004 21:55] MySQL Verification Team
Use the implib tool instead:

C:\test>implib libmysql.lib libmysql.dll

Borland Implib Version 3.0.8 Copyright (c) 1991, 1999 Inprise Corporation

C:\test>dir
 O volume na unidade C não tem nome.
 O número de série do volume é 602A-1FA1

 Pasta de C:\test

2004/10/01  18:52    <DIR>          .
2004/10/01  18:52    <DIR>          ..
2004/09/08  05:56           245.760 libmySQL.dll
2004/10/01  18:52            11.776 libmysql.lib
               2 arquivo(s)        257.536 bytes
               2 pasta(s) 28.884.336.640 bytes disponíveis

Then compile your application using the libmysql.lib created by implib
from libmysql.dll. That is how WinMySQLAdmin was build with Builder 4.0.
[2 Oct 2004 17:29] Marcin Lewandowski
I've found a solution.

If I add only libmysql.lib to project, the project should compile statically.