我用VC写了一个DLL,如有a.dll ,a.lib ,a.h 文件,其中有个函数
int OpenCom(int nCom)想在Delphi中使用,我该如何引用呢?
函数原形: 
   __declspec(dllexport)  int _stdcall OpenCom(int nCom)大虾我在线等待...

解决方案 »

  1.   

    在要调用的单元文件中的
    implementation
    {$R *.dfm}
    下面加上function OpenCom(nCom:Integer):Integer; stdcall; external 'a.dll';然后在需要时调用该函数就可以了。
      

  2.   

    注意把a.dll和Delphi写的exe文件放在同一目录下。
    如果出错,把__declspec(dllexport)  int _stdcall OpenCom(int nCom)换成WINAPI int _stdcall OpenCom(int nCom)编译后试试。