讨论一下平台调用的问题

brbrm 2003-08-19 08:56:22
对于一个DLL,有没有办法罗列出它所提供的所有方法?

特别是对于系统DLL,比如GDI32.DLL、MSCOREE.DLL等。

如果是.NET托管代码写的DLL,情况又如何呢?
...全文
32 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
brbrm 2003-08-20
  • 打赏
  • 举报
回复
TO saucer(思归, MS .NET MVP) :

use Reflection to retrieve,
may give some sample code?
saucer 2003-08-20
  • 打赏
  • 举报
回复
see

http://www.expresscomputeronline.com/20030113/techspace2.shtml

using System.Reflection;

Assembly a = Assembly.LoadFrom("...");
foreach (Type t in a.GetExportedTypes())
{
foreach(PropertyInfo pi in t.GetProperties())
...
foreach (EventInfo ei in t.GetEvents())
...
foreach (MethodInfo mi in t.GetMethods(BindingFlags.Instance |
BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic))
...


}
saucer 2003-08-19
  • 打赏
  • 举报
回复
>>>>如果是.NET托管代码写的DLL,情况又如何呢?

you should be able to use Reflection to retrieve all types in the assembly and get their properties/methods/events
saucer 2003-08-19
  • 打赏
  • 举报
回复
look for a tool call dumpbin.exe (normally in C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin)

dumpbin /exports yourdll.dll
雪狼1234567 2003-08-19
  • 打赏
  • 举报
回复
如果厂家不提供给你,你只好用反编译工具啦,不过这很痛苦啊

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧