兄弟我用DELPHI5开发了一个动态连接库,其中输入、输出参数为PCHAR类型,在使用VC来调用时,有些问题,请问VC中使用什么类型的参数。请各位帮忙解答。

解决方案 »

  1.   

    应该用 *BYTE,记住给BYTE分配内存大小.
      

  2.   

    我的程序是这样的,请指教
    DELPHI中
      function test(var teststr: PChar):integer;stdcall;function test(var teststr: PChar):integer;
    begin
      Result := 0;
      StrPCopy(teststr,'aaaaaaaa');
    end;VC
    typedef int (__stdcall * pTest)(char *szStr);  HINSTANCE hLibrary;
    pTest Test;
    hLibrary=LoadLibrary("test.dll");
    if(!hLibrary)
    {
    AfxMessageBox("can't open dll file");
    return;
    }
    Test=(pTest)GetProcAddress(hLibrary,"test");
    char *buffer;
    int a= (*Test)(buffer);  //此处出错
    CString s=buffer;
        AfxMessageBox(s);
    FreeLibrary(hLibrary);
      

  3.   

    感谢各位,我已经换为VC来开发DLL了