本文实例是在vs2005中调用dll
一、静态调用方法:
   (1)在工程属性设置中加入该库的静态库(.lib)
   (2)将该库的头文件(.h)加入到工程中;
   (3)将动态库(.dll)放到工程中相应目录下;
前两步骤是为了标明动态库的入口函数,以使其他函数可以正确的调用动态库。调用时,只需要包含.h头文件就可以使用库中的函数了。
二、动态调用方法:
动态调用法要用Windows API中的LoadLibrary()GetProcAddress()来调入dll库,指出库中函数位置。
该方法不需要.lib库和.h文件。下面以一个实例来说明该方法。
#include "stdafx.h"
#include <wtypes.h>

int (*GetMachineFingerprint)(unsigned char *);    

int _tmain(int argc, _TCHAR* argv[])
{
  HINSTANCE     hInst;            

  hInst     =     LoadLibrary("MachineInfo.dll");            
  (FARPROC&)GetMachineFingerprint = GetProcAddress(hInst,"GetMachineFingerprint");    
    
  unsigned char FingerPrintf[20] = {0};

  GetMachineFingerprint(FingerPrintf);

  printf("%s\n", FingerPrintf);
    
  FreeLibrary(hInst);    

  while(getchar());

  return 0;
}
上面代码是调用库MachineInfo.dll中的函数
int GetMachineFingerprint(unsigned char *pFingerPrint)