GetProcAddress 没有头文件的 Class 对象
应该可以从dll中获取类对象,而不需要相应的dll头文件!?但是,如果头文件中没有已知类型,如何为 GetProcAddress 制作类的 typedef 呢?
有例子吗?!
谢谢并问候,
leon22
It should be possible to get an class object from an dll without the corresponding dll header file!? But how can I make the typedef of the class for GetProcAddress without known type from header file?
Have you an example?!
Thanks and greets,
leon22
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
GetProcAddress
为您提供函数的地址。当您拥有 C++ 类成员函数的完整修饰名时,您可以获取它的地址。使用相同的信息,您可以使用undname
实用程序获取方法的签名。但是您将需要头文件来获取类定义本身。
GetProcAddress
gives you the address of a function. When you have the full decorated name of a C++ class member function, you can get the address of it. With the same information you can get the signature of the method with theundname
utility.But you will need the header file to get class definition itself.
如果您不知道所涉及的类型,则无法调用函数,这几乎就结束了。
If you don't know the types involved, you can't call a function, and that's pretty much the end of that.
如果我正确理解你的问题,你想要 DLL 中对象(即实例)的地址。 GetProcAddr 不会给你这个,但它可以给你一个函数的地址,如果 DLL 中存在这样的函数,那么这个函数又可以给你对象的地址。如果该函数具有外部“C”链接,则也不会有任何名称损坏。
If I understand your question correctly, you want the address of an object (i.e. an instance) in the DLL. GetProcAddr won't give you that, but it can give you the address of a function that can, in turn, give you the address of the object, if such a function exists in the DLL. if that function has extern "C" linkage, there won't be any name mangling either.