Bug #12759 Linking with mysqlclient.lib and VC 6.0 gets __aligned_malloc/free undefined
Submitted: 23 Aug 2005 16:11 Modified: 23 Aug 2005 18:04
Reporter: Anders Karlsson Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.11 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[23 Aug 2005 16:11] Anders Karlsson
Description:
This seems to be related MySQL being built with VC 7/.NET. These two are two only two issues. This only happens when linking with libmysql.lib, only when linking with mysqlclient.lib. This might be a non-issue, but this worked at least in 5.0.4 I think, and as the move from VC6 to VC7 support isn't documented, this may be a bug, in particular as libmysql.lib works.

I'm not sure if this is a bug or not, but wanted to report it for future reference for anyone else having this problem.

How to repeat:
Compile and build any simple MySQL C-program on windows XP using C 6.0. You will get 2 unresolved externals.

A W/O is rebuilding mysqlclient.lib from source with VC6.0, which works without problems, and then linking the application with this rebuilt mysqlclient.lib.
[23 Aug 2005 16:15] Anders Karlsson
My language was a bit unclear, I meant to say:
This doesn't happen when linking with libmysql.lib,
only when linking with mysqlclient.lib.
[23 Aug 2005 18:04] MySQL Verification Team
Below the steps I did:

1- Downloaded and installed the mysql-noinstall-5.0.11-beta-win32.zip package.
2- Created an empty project with VC++ 6.0 console type.
3- Added a new file and edited the below code:

#include <stdlib.h>
#include <stdio.h>
#include <my_global.h>
#include "mysql.h"

int main()
{
  MYSQL* mysql;
  mysql= mysql_init(NULL);
  mysql_options(mysql,MYSQL_SET_CHARSET_NAME,"cp1251");
  mysql_real_connect(mysql,"localhost","root","","test",0,NULL,0);
  printf("Server version: %s\n", mysql_get_server_info(mysql));
  mysql_close(mysql);
  return 0;
}

4- In C++ Settings tab:
    debug
    Preprocessor -> ..\include
    Code Generation -> Debug Multithreaded
   
    Release
    Preprocessor -> ..\include
    Code Generation -> Multithreaded

5- Link Settings Tab:

    Added the below libraries:
    debug
    wsock32.lib  ..\lib\debug\mysqlclient.lib
    
     release
     wsock32.lib ..\lib\opt\mysqlclient.lib

6- Compiled:

--------------------Configuration: bug12759 - Win32 Debug--------------------
Compiling...
bug12759.cpp
Linking...

bug12759.exe - 0 error(s), 0 warning(s)

--------------------Configuration: bug12759 - Win32 Release--------------------
Compiling...
bug12759.cpp
Linking...

bug12759.exe - 0 error(s), 0 warning(s)

6- Tested the application

C:\temp>bug12759
Server version: 5.0.11-beta-nt
[24 Aug 2005 8:19] Anders Karlsson
I did just what you did, and I can't link that, due to those 2 unresolved externals. Strange. I think, but I'm guessing here, that this problem is due to MSVC runtime library changes, the two externals missing seems to have been added in msvcr71 or something like that. Might it be that you used VC6 but the new MSVC runtime library? Otherwise we'll just have to close this one I guess, until I can find out a way to reproduce this.
[24 Aug 2005 14:27] MySQL Verification Team
I have both version installed, but I think the libraries are installed
in their own install path. So I can't say you with accuracy if my
environment mask that issue, need to test with a clean machine.
Also my VC++ 6.0 is installed with SP 5 (I don't use SP 6).