Re: Windows C/C++ Linker errors
Posted by: Jean-Philippe Léveillé
Date: October 06, 2005 02:43PM

I get the same linker errors when trying to build my app with mysqlclient.lib. However, building it with libmysql.lib and providing libmysql.dll in the same folder where the .exe is run from, everything works fine.

I noticed something weird in the doc (24.2.2 - CHM from version 4.1.12 for WINNT)

---
Initialize the MySQL library by calling mysql_library_init(). The library can be either the mysqlclient C client library or the mysqld embedded server library, depending on whether the application was linked with the -libmysqlclient or -libmysqld flag.
...
The purpose of calling mysql_library_init() and mysql_library_end() is to provide proper initialization and finalization of the MySQL library.
---

Then it says mysql_init() will call mysql_library_init() if it hasn't been called before. The problem is, I haven't been able to call mysql_library_init() in my code when linking with libmysql.lib (and mysqlclient.lib - although using mysqlclient.lib returns "already defined" and "unresolved external symbol" errors). If you look at libmysql.def in MySQL include dir, mysql_library_init() AND mysql_server_init() aren't there! So how am I suppose to call mysql_library_init() if it cannot resolve the link to this very function? I'm bringing this information here because I noticed that some of the unresolved link issues included a call to mysql_server_init()...

BTW, I checked in libmysqld.def and the function is defined there, but not in libmysql.def. I'm also able to compile and link with libmysqld (but the problem is, I can't connect to an external server - I'm blocked to a very local database when building with libmysqld).

Oh, and I never got answers when I raised this very issue months ago (http://forums.mysql.com/read.php?58,21256,21256, http://forums.mysql.com/read.php?58,20543,20543)

Options: ReplyQuote


Subject
Views
Written By
Posted
786
September 21, 2005 12:32PM
Re: Windows C/C++ Linker errors
496
October 06, 2005 02:43PM
463
January 13, 2006 05:30PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.