纯C加载dll与未知的接口 [英] Pure C loading dll with unknown interface

查看:57
本文介绍了纯C加载dll与未知的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想使用LoadLibrary,我必须先知道接口,AfxLoadLibrary需要C ++。有没有办法使用纯C?



那么加载时静态导入的dll和运行时导入的除了加载时之外的其他任何东西都可以'处理版本?



这是插件系统onload我不知道会加载哪些插件?

If I want to use LoadLibrary I must know the interface before and AfxLoadLibrary needs C++. Is there some way to use pure C?

And so what''s than differemce between loadtime static imported dll and runtime imported any other than that on loadtime one can''t handle versions?

It is plugin system onload I don''t know which plugins will be loaded?

推荐答案

LoadLibrary [ ^ ]在C或C ++中工作正常。



关于你的其余问题,我不是真的确定你的问题是什么。
LoadLibrary[^] works fine in C or C++.

As to the rest of your question, I am not really sure what your problem is.


静态加载DLL和LoadLibrary之间的区别在于,在第一种情况下,DLL在启动可执行文件时必须存在。因此,您必须在编程时知道它存在。



如果是LoadLibrary,您的程序可能会在运行时了解DLL,例如通过读取配置用你的插件文件。然后它可以通过LoadLibrary加载DLL。尽管如此,你的程序必须至少知道名称或ordnial数字,并调用加载DLL的某些过程的约定来通过GetProcAddress访问它们。
The difference between statically loading a DLL and LoadLibrary is that in the first case the DLL must be present at the time your executable is started. So you must know at the time of programming that it exists.

In case of LoadLibrary, your program may learn about a DLL at runtime, for example by reading a configuration file with your plugins. It can then load the DLL via LoadLibrary. Nevertheless, your program must at least know tne name or ordnial numbers and calling convention of some procedures of the loaded DLL to get access to them via GetProcAddress.


也许我的问题不清楚,但我可以使用



Maybe my question is unclear, but I can use

typedef void* (*unknown)(
#ifdef __cplusplus
...
#endif
);





和带有未知任意的重新加载工作正常。



and retype load with unknown everithings works fine then.


这篇关于纯C加载dll与未知的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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