如何用dll
1.要注册吗,如要的话,如何注册
2。如何dll看的函数。
3。如何用LoadLibary(),调用函数
谢谢
问题点数:100、回复次数:10Top
1 楼zhangnanonnet(鱼欢)回复于 2002-04-22 09:35:19 得分 0
不用注册,如何使用看看《技术内幕》,很简单,至于看到DLL内的函数,可以用VS自带的一个工具,叫什么dep...,你找找就有了Top
2 楼quengzi(Hades)回复于 2002-04-22 09:46:57 得分 100
一般使用dll有隐式连接和显式两种。
你可以参考:
The two major benefits to using run-time linking are:
When the DLL is not available, an application using load-time dynamic linking simply terminates, while the run-time dynamic linking is able to respond to the error.
If the DLL changes, an application that uses load-time dynamic linking may again terminate, while an application linked at run-time is only affected if the desired functions are not present in the new DLL.
Traditional Linking—The Steps
These are the steps you need to follow every time you want to link to a DLL from your application:
Define the function prototypes.
typedef short (CALLBACK* FindArtistType)(LPCTSTR);
Load the DLL using the LoadLibrary function.
Keep the handle to the DLL instance.
dllHandle = LoadLibrary("art.dll");
Get a pointer to each function using the GetProcAddress function.
Cast function pointers to the types defined in Step 1.
FindArtistPtr = (FindArtistType)GetProcAddress(dllHandle,
"FindArtist");
Verify function pointers.
if (runTimeLinkSuccess = (NULL != FindArtistPtr))
Use functions.
short retVal = FindArtistPtr(myArtist);
Unload the DLL.
freeResult = FreeLibrary(dllHandle);
Top
3 楼quengzi(Hades)回复于 2002-04-22 09:56:50 得分 0
关于第二个问题:
c:\vc\...\bin\dumpbin /exports test.dll > test.def
:> lib /def: test.def
一般用IDE 查看test.def文件就可以看到函数
但有时候会和定义有所差别。
比如:__C 和__cdecl 或者:__pascal
具体的东西还是你自己试一试。
我也是大概了解,点到而已。
还有的方法是使用工具。
Top
4 楼wwtmw(剑重无锋 大巧不工)回复于 2002-04-22 09:59:58 得分 0
Dependency Walker好像不是一切Dll都看到喔,谁知道为什么?
Top
5 楼wwtmw(剑重无锋 大巧不工)回复于 2002-04-22 10:14:06 得分 0
请问 如果只是给你一个 one.DLL文件,只知道大概功能,不知道其他
怎样 调用??
Top
6 楼macbolo()回复于 2002-04-22 10:19:56 得分 0
GetProcAddress的第2个参数如何得到Top
7 楼xpf_2000(萧丰)回复于 2002-04-22 10:22:33 得分 0
用vs带的depends工具Top
8 楼mryinliang(海崖)回复于 2002-04-22 10:59:47 得分 0
用depends好象不能知道函数的调用方法,即要传递几个什么样的参数
,函数返回什么Top
9 楼xpf_2000(萧丰)回复于 2002-04-22 16:50:45 得分 0
那不可能知道,如果知道就没有秘密了:)Top
10 楼mryinliang(海崖)回复于 2002-04-22 17:24:10 得分 0
如果不知道调用方法,光知道一个函数名有什么用呢?Top




