如题,我用Delphi写了一个DLL,我需要测试它在VC里面的使用情况
现在不知道怎么弄,希望各位大虾帮帮忙,感谢!!

解决方案 »

  1.   

    和 delphi 里面是一样的
    主要用C++的语法罢了
      

  2.   

    但是好像要一个LIB文件,我没有在,怎么搞
      

  3.   

    打开VC,用动态导入
    就是 LoadLibrary GetProcAddress, FreeLibrary
    这些函数。记住Delphi一定要用stdall导出。
      

  4.   

    我是用的STDCALL导出的,但是也不行,我把代码贴出来,帮忙看看,谢谢
    Delphi 的代码,DLL的library Dlltest;
    uses
      SysUtils,
      Classes;{$R *.res}function Max(X:Integer;Y:Integer):integer;StdCall;
    begin
      if x>y then Result:=x;
      if x<y then Result:=Y;
      if x=y then Result:=x;
    end;function Min(X:Integer;Y:Integer):Integer;StdCall;
    begin
      if x>y then Result:=Y;
      if x<y then Result:=X;
      if x=y then Result:=x;
    end;
    exports
      Max,
      Min;
    begin
    end.C中的代码#include <stdio.h>
    #include<windows.h>
    void main(void)
    {
    int S;
    typedef int(*pMax)(int a,int b);
    typedef int(*pMin)(int a,int b);
    HINSTANCE hDLL;
    pMax Max;
    hDLL=LoadLibrary("Dlltest.dll");
    Max=(pMax)GetProcAddress(hDLL,"Max");
    S=Max(5,8);
        printf("比较的结果为%d\n",S);
    FreeLibrary(hDLL);
    }
      

  5.   

    typedef int(__stdcall *pMax)(int a,int b);
    typedef int(__stdcall *pMin)(int a,int b);
      

  6.   

    typedef int(WINAPI *pMax)(int a,int b);
    typedef int(WINAPI *pMin)(int a,int b);