MySQL 在 Windows 7 上使用 libmysql.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7944991/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:29:15  来源:igfitidea点击:

Using libmysql.dll on Windows 7

mysqlcwindowspidgin

提问by Alon Amir

I have been working on a program which connects to libmysql.dll. In the part of the code that uses it, I have included both winsock2.h and mysql.h. I have written the program already and it works really well on both Linux and Windows XP.

我一直在开发一个连接到 libmysql.dll 的程序。在使用它的代码部分,我同时包含了 winsock2.h 和 mysql.h。我已经编写了该程序,它在 Linux 和 Windows XP 上都运行良好。

For Windows XP, I have found that libmysql.dll must be in the system32 directory in order for the code to work. However, in Windows 7, even having the libmysql.dll file in system32 does not allow it to work. Apparently it could not find libmysql.dll. Given that this is a pidgin plugin, that is the only library that is not required by Pidgin, and therefore I had to place it somewhere. The problem is, I don't know where.

对于 Windows XP,我发现 libmysql.dll 必须在 system32 目录中才能使代码工作。但是,在 Windows 7 中,即使在 system32 中有 libmysql.dll 文件也不允许它工作。显然它找不到 libmysql.dll。鉴于这是一个 pidgin 插件,这是唯一一个 Pidgin 不需要的库,因此我不得不将它放在某个地方。问题是,我不知道在哪里。

Where must it be placed on newer systems, like Windows 7?

它必须放置在较新的系统(如 Windows 7)上的什么位置?

回答by Alon Amir

The libmysql.dll file is a part of the MySQL Connector/C lib-

libmysql.dll 文件是 MySQL Connector/C lib-的一部分

http://dev.mysql.com/downloads/connector/c/

http://dev.mysql.com/downloads/connector/c/

Have you tried placing the file in the directory your application is being launched?

您是否尝试将文件放在您的应用程序正在启动的目录中?

Unless the program that makes use of this dll was written in a way that it's searching for the dll in specific places (unlikely), it should work both ways - system32 or the program's running directory.

除非使用此 dll 的程序的编写方式是在特定位置(不太可能)搜索 dll,否则它应该可以双向工作 - system32 或程序的运行目录。

Edit:

编辑:

Also make sure that the system32 dir exists in your %PATH% environment variable.

还要确保 system32 目录存在于 %PATH% 环境变量中。