rt!有代码分多给!

解决方案 »

  1.   

    要调用VC的dll的话你得先把C++头文件翻译成Delphi格式的,那样就好用了!
      

  2.   

    有没有类似于vb中的简单办法? 用loadlibrary()动态加载可以吗?
      

  3.   

    不行的。
    比如C++ dll中的函数这么声明:
    //---------------------------------------------------------------------------
    #include <vcl.h>
    #pragma hdrstopint WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
    {
        return 1;
    }//---------------------------------------------------------------------------extern "C" __declspec(dllexport)
    int WINAPI Double (int n)
    {
    return n * 2;
    }extern "C" __declspec(dllexport)
    int WINAPI Triple (int n)
    {
    return n * 3;
    }__declspec(dllexport)
    int WINAPI Add (int a, int b)
    {
    return (a + b);
    }那么相应Delphi中要翻译过来,才能使用:{definition of the functions of the DLL}
    function Add (A, B: Integer): Integer;
      stdcall; external 'CPPDLL.DLL' name '@Add$qqsii';
    function Double (N: Integer): Integer;
      stdcall; external 'CPPDLL.DLL' name 'Double';
    function Triple (N: Integer): Integer;
      stdcall; external 'CPPDLL.DLL';