MS VC中如何调用其他DLL中的函数?

    用下面的命令看在oracommon10.dll中有那些函数是可以调用的:

C:\TEMP> dumpbin /EXPORTS oracommon10.dll
   ordinal hint RVA      name

          1    0 000C37C4 DBMSBKRS
          2    1 000012C0 OCITypeCollExtTypeCode
   ......
         65   40 00005FD0 kcbhxoro
   ......

    接下来远择你需要的函数, 比如kcbhxoro函数, 编辑一个oracommon.def文件:

EXPORTS
  kcbhxoro @ 65
  ......

    然后用LIB命令来生成一个oracommon.lib文件, 这个文件在编译时需要用到:

C:\TEMP>LIB /DEF:oracommon.def
Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LIB : warning LNK4068: /MACHINE not specified; defaulting to IX86
   Creating library oracommon.lib and object oracommon.exp

    在程序中可以调用kcbhxoro函数了, 当然你要知道函数的参数了, 然后编译程序:

C:\TEMP>cl /ML ocp.c oracommon.lib
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.

ocp.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/out:ocp.exe
ocp.obj
oracommon.lib

    要在Oracle上开发一些很Internal的工具, 首先要解决法律上的问题, 然后要获得这些函数的参数.

发表留言:

« Previous | Main | Next »

英语900句 | English 900

  • He's the youngest in the family.
  • 他是一家中最小的.
  • He looks much younger than he is.
  • 他看起来比他实际上年轻得多.
  • I came here when I was 20.
  • 我二十岁来这儿.
  • I started school at the age of 6.
  • 我六岁开始上学.
  • My father is over 60 years old.
  • 我父亲已年过六十了.