sichuanjmy
驱动牛犊
驱动牛犊
  • 注册日期2004-03-24
  • 最后登录2009-08-26
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望20点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1481回复:5

如何在运用程序中调用DLL

楼主#
更多 发布于:2004-11-18 19:38
各位大虾,你们好,我自己生成了一个动态连接文件DLL,但不知如何才能把它用到运用程序中(指隐含连接),请告诉我具体的详细步骤好吗?谢谢各位了
tangtang
驱动牛犊
驱动牛犊
  • 注册日期2004-09-17
  • 最后登录2005-04-14
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2004-11-18 20:40
你是不是作了一个驱动,想用?
我不太清楚别的操作系统下的驱动如何调用,但我想都是有相同之处的。
我知道如何调用wince下的流接口驱动,挺简单,就用读写文件的函数ReadFile和WriteFile就可以了,当打开文件的时候用的是如
COM:1这样的文件名。
但是,驱动是不能用LoadLibrary这样调用的,原因见下面,说的是wince下的驱动,但是我觉得应该都是可以的。
A device driver isn't loaded by the application communicating with the driver. Instead, the device manager, Device.exe, loads most drivers, including all stream drivers. This state of affairs affects the driver in two ways. First, an application can't simply call private entry points in a driver as it can in a DLL. The only way an application could directly call an entry point would be if it called LoadLibrary and GetProcAddress to get the address of the entry point so the entry point could be called. This situation would result in the DLL that implemented the driver (notice I'm not calling it a driver anymore) being loaded in the process space of the application, not in the process space of the device manager. The problem is that this second copy of the DLL isn't the driver―it's the DLL that implemented the driver. The difference is that the first copy of the DLL (the driver)―when properly loaded by the device manager―has some state data associated with it that isn't present in the second copy of the DLL loaded by the application. Perversely, the calls to LoadLibrary and GetProcAddress will succeed because the driver is a DLL. In addition, calling the entry points in the driver results in calling the correct code. The problem is that the code will be acting on data present only in the second copy of the DLL, not in the proper data maintained by the driver. This situation can, and usually does, result in subtle bugs that can confuse and even lock up the hardware the driver is managing. In short, never interact with a driver by calling LoadLibrary and GetProcAddress.
由于刚学,好多不会,所以讲不明白。应该会有高手出现的。
祝好运!
fslife
驱动大牛
驱动大牛
  • 注册日期2004-06-07
  • 最后登录2016-01-09
  • 粉丝0
  • 关注0
  • 积分9分
  • 威望49点
  • 贡献值0点
  • 好评度20点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2004-11-18 21:55
用Loadlibrary(),去MSDN上随便找个例子吧。
在交流中学习。。。
hasis
驱动牛犊
驱动牛犊
  • 注册日期2003-01-07
  • 最后登录2006-04-03
  • 粉丝0
  • 关注0
  • 积分57分
  • 威望12点
  • 贡献值0点
  • 好评度4点
  • 原创分0分
  • 专家分0分
地板#
发布于:2004-11-19 13:44
LoadLibrary()的例子还是很好用的呀,呵呵,特别是隐性链接。
大学课程加上语文吧,否则在驱网里都不会提问题:)
xx_focus
驱动中牛
驱动中牛
  • 注册日期2003-08-06
  • 最后登录2007-06-08
  • 粉丝0
  • 关注0
  • 积分96分
  • 威望10点
  • 贡献值0点
  • 好评度8点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2004-11-19 15:32
在本论坛搜索 阿蒙的动态链接库DLL编程资料(CHM)
forever-006
驱动牛犊
驱动牛犊
  • 注册日期2004-11-19
  • 最后登录2005-05-31
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2004-11-19 15:47
用Loadlibrary()可以实现DLL的动态连接
游客

返回顶部