Delphi写的DLL在VC中可以调用吗,如何调用?
例如Delphi写的DLL有下列函数:
function Test1(var D: Byte): Integer; stdcall;
begin
  d := 255;
  Result := 0;
end;function Test2(var D: Integer): Integer; stdcall
begin
  d := 65535;
  Result := 0;
end;   在VC中如何声明,如何调用?

解决方案 »

  1.   

    当然可以了
    另外,我不知道你为何用var D:integer):integer
      

  2.   

    可以,DLL是通用的你的Code中没有必要使用Var变参的
      

  3.   

    不能用,你得写成地址的,C里是不支持传值的,这两个函数到C里调用都变成0了。
    要传入地址,然后在改变地址里的值
    function Test2(pD: pInteger): Integer; stdcall
    begin
      d^ := 65535;
      Result := 0;
    end;   c里是
    long Test2(int* pD)
      

  4.   

    补充一下,调用时候
    long l;
    Test2(&l);
      

  5.   

    我用var是想函数调用完必后再把参数值传回来
    用var传递的参数实际不就是一个地址吗