Visual Studio Mangling's name is "YAPEAV" and Mysql

I get an unresolved external character error when binding my code with MySQL Connector C ++ 1.1.0.
Here is the error message:

6>database.lib(db_manager.obj) : error LNK2019: unresolved external symbol "class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_driver_instance(void)" ( ?get_driver_instance@mysql @ sql@ @ YAPAVMySQL_Driver@12 @XZ) referenced in function "class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_mysql_driver_instance(void)" ( ?get_mysql_driver_instance@mysql @ sql@ @ YAPAVMySQL_Driver@12 @XZ) 

I used dumpbin to get a list of characters in mysqlconn-static.lib and found a similar character:

 COMDAT; sym= "class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_driver_instance(void)" ( ?get_driver_instance@mysql @ sql@ @ YAPEAVMySQL_Driver@12 @XZ) 

When these two lines are lined up, the difference looks like this:

 ( ?get_driver_instance@mysql @ sql@ @ YAPEAVMySQL_Driver@12 @XZ) ( ?get_driver_instance@mysql @ sql@ @ YAPAVMySQL_Driver@12 @XZ) 

What is the difference in name header between YAPEAV and YAPAV ?

I have an idea that my problem is with inconsistencies between the MySQL Connector library and the way I build my code.

I searched the Internet and found a bug in MySQL Connector 1.1.0, but was changed to "not a bug".

I am using Visual Studio 2010 build for a 32-bit target using a 64-bit platform.
MySQL Connector C ++ - version 1.1.0.

+4
source share
1 answer

The MSVC undname is your friend. Using this, you will find that

  • ?get_driver_instance@mysql @ sql@ @ YAPEAVMySQL_Driver@12 @XZ matches:

     class sql::mysql::MySQL_Driver * __ptr64 __cdecl sql::mysql::get_driver_instance(void) 
  • ?get_driver_instance@mysql @ sql@ @ YAPAVMySQL_Driver@12 @XZ matches:

     class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_driver_instance(void) 

The difference lies in decorating __ptr64 . It looks like you are building a 32-bit program, but you are linking to a library created for a 64-bit purpose.

+3
source

All Articles