简体   繁体   English

Qt-creator 使用 dll

[英]Qt-creator use dll

How to access to functions in given DLL in Qt?如何访问 Qt 中给定 DLL 中的函数?

You have to include the header file for the DLL in your source file, of course:当然,您必须在源文件中包含 DLL 的 header 文件:

#include "MyDll.h"

Then, in the .PRO file, just add:然后,在.PRO文件中,只需添加:

LIBS += MyDll.dll

You can use the Qt class "QLibrary".您可以使用 Qt class“QLibrary”。 You can find a detailed description and examples at http://doc.trolltech.com/4.7/qlibrary.html您可以在http://doc.trolltech.com/4.7/qlibrary.html找到详细说明和示例

The main idea is, that you define a function pointer, assign it with QLibrary::resolve to the function in the dll, and you can then call it normally as any function. The main idea is, that you define a function pointer, assign it with QLibrary::resolve to the function in the dll, and you can then call it normally as any function.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM