CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

如何用dll

楼主macbolo()2002-04-22 09:21:51 在 VC/MFC / 基础类 提问

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

相关问题

  • 如何使用dll
  • 如何使用DLL
  • 如何调用dll
  • 如何调用DLL?
  • 如何调用dll?
  • 如何调用 DLL
  • 如何封装dll?如何调用dll?
  • CB中如何使用DLL
  • Asp中如何调用Dll?
  • 如何调用dll? 多谢!

关键词

  • 函数
  • dll
  • 注册
  • application
  • 调用
  • 知道
  • link
  • dynamic
  • 方法
  • 使用

得分解答快速导航

  • 帖主:macbolo
  • quengzi

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo