我想要把自己编写的 a.DLL用于程序中,编译时都能通过,但到了执行时却说找不到a.dll 的路径。请问我如何把路径添加进去? (已包含头文件了)

解决方案 »

  1.   

    to   li_yirong (lyr):
    在你的a.dll工程中找到a.lib文件,将a.dll;a.lib放到需调用该dll工程的debug目录中,system32下也可。在当前vc6的菜单的project->settings->link->object/libaray modules:中将你的a.lib所在地址路径粘贴过来。再重新编译一道,应该可以了。
      

  2.   

    tools -options-directories,选择directories for lib,指定路径。ok
      

  3.   

    dynamic-link library (DLL) 
    A feature that allows executable code modules to be loaded on demand and linked at run time. This enables the library-code fields to be updated automatically, transparent to applications, and then unloaded when they are no longer needed. 
    You can use LIB to create an object (.OBJ) file that contains a copy of a member of an existing library. To extract a copy of a member, use the following syntax:LIB library /EXTRACT:member /OUT:objectfileThis command creates an .OBJ file called objectfile that contains a copy of a member of a library. The member name is case sensitive. You can extract only one member in a single command. The /OUT option is required; there is no default output name. If a file called objectfile already exists in the specified directory (or the current directory, if no directory is specified with objectfile), the extracted objectfile replaces the existing file.You can use LIB with the /DEF option to create an import library and an export file. LINK uses the export file to build a program that contains exports (usually a dynamic-link library (DLL)), and it uses the import library to resolve references to those exports in other programs.In most situations, you do not need to use LIB to create your import library. When you link a program (either an executable file or a DLL) that contains exports, LINK automatically creates an import library that describes the exports. Later, when you link a program that references those exports, you specify the import library.However, when a DLL exports to a program that it also imports from, whether directly or indirectly, you must use LIB to create one of the import libraries. When LIB creates an import library, it also creates an export file. You must use the export file when linking one of the DLLs.
      

  4.   

    两种方法,一种方法:象调用别的文件的函数一样,将编译dll文件生成的.lib文件和.dll文件放到工程目录下,然后象jackhu(隐士) 说的那样,把.lib文件导入到工程当中,然后对.dll文件当中的接口的调用就象对别的文件中的函数调用一样。另一种方法,利用LoadLibrary函数,把.dll文件装载进来,然后利用GetProcAddress函数得到你要调用的函数的句柄,就可以调用这个函数了。
      

  5.   

    第二种方法里面,可以设置LoadLibrary函数查找dll文件的默认路径。方法:Tools->Options->Directories,选择show directories for下拉菜单当中的Library files,然后在下面的编辑框里面写入你自己指定的dll文件所在的路径就可以了。系统会自动的去查找指定的所有路径。
      

  6.   

    好象大家都错了吧
    只是找不到a.dll而已嘛
    好办
    把a.dll放到windows目录下的system目录下
    或者你把a.dll的绝对路径加到PATH中也行
      

  7.   

    哈哈,把.dll文件都放到window自己的目录下,你的系统空间得多大?一个软件做完以后,难道还得让使用的用户自己把所有的dll文件放到window的system目录下?