如何在VC ++ 6.0项目中使用DLL而不需要它的.h和.lib文件? [英] How to use a DLL without the need of its .h and .lib files in a VC++ 6.0 Project?

查看:692
本文介绍了如何在VC ++ 6.0项目中使用DLL而不需要它的.h和.lib文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何执行以下操作:

I don't know how to do the following:


  • 我使用的是MS Visual C ++ 6.0

  • 我有一个Win32 DLL项目,它是可编译的。

  • 我有另一个项目,这次是一个Win32控制台项目,使用
    DLL包括它的头文件并链接
    的.lib文件的DLL。

现在我想要另一个项目,类似于第二个但不使用头文件和lib文件。

这是可能吗?到处我读你需要dll + lib + h或dll + h。如果你认为如果你知道接口,一个DLL文件就足够了?

Is that possible? Everywhere I read you need either dll+lib+h or dll+h. If thought if you know the interfaces, a DLL file is sufficient?

Btw,通过使用DLL我的意思是,使用在DLL中定义的类和函数。

Btw, by "using a DLL" I mean, using the Classes and Functions defined in the DLL.

推荐答案

这是可能的,如果你只是有extern C函数。如果是这种情况,方法可以加载dll与 LoadLibrary ,然后导入每个函数与 GetProcAddress 当然你需要知道函数签名来创建一个正确声明的函数指针。使用类相反是几乎不可能的。

It is possible if you just have plain "extern C" functions. If this is the case the approach could be loading the dll with LoadLibrary, and then import each function with GetProcAddress, of course you need to know the function signature to create a properly declared function pointer. Using classes per contrary is almost impossible.

这篇关于如何在VC ++ 6.0项目中使用DLL而不需要它的.h和.lib文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆