应是你的 VC 做的过程 ReturnJubCdLabel(int n,char*p);
 要用 stdcall 定义其参数调用方式,在Delphi中方可在默认方式下
顺利调用,详细可看看MSDN,和查看DELPHi有关的STDCALL,CDECL 等等的
定义说明
  

解决方案 »

  1.   

    我是定义了,function ReturnJubCdLabel(pslot:Integer;pLabel:pChar):Integer;stdCall;有这样的报错是不是和操作系统有错误有关!其他的过成不需传递字符指针,这样调用都没错的!
      

  2.   

    ReturnJubCdLabel的圆马如下:
    extern"C"__declspec(dllexport) int ReturnJubCdLabel(int pSlot,char *pLabel)
    {
    AFX_MANAGE_STATE(AfxGetStaticModuleState());  DWORD t=100;
        LPDWORD size=&t;
     
    char ComName[100];
        ::GetComputerName(ComName,size);
    CString m_ComName(ComName);
           jbmSetupConnection(m_ComName);//jbmSetupConnection是将这里要用的第3方动态连接库与机算计相连的函数
    JBMSDK_JUKEBOX_T*m_pJukebox=new JBMSDK_JUKEBOX_T;
        jbmGetJukeboxByNr(0,m_pJukebox);//Get jukebox's information include numMagazines and numSlots;
    UINT JukeNr=m_pJukebox->jbxId;//Jukebox'ID;
       JBMSDK_SLOT_T*m_pSlotIfom=new JBMSDK_SLOT_T; //这个接够里有一个260位的字符树组
      
       jbmGetSlot(JukeNr,pSlot,m_pSlotIfom);//Get the first slot infomation. 给这字符数组里添字符  strcpy(pLabel,m_pSlotIfom->label);//传给delphi提供的pchar参数!
       delete m_pSlotIfom;
       delete m_pJukebox; return 0;}
    高手救命!
      

  3.   

    var
      volume: array[0..260] of Char;
    begin
      ReturnJubCdLabel(1, volume);
      ShowMessage(volume);
    end;
      

  4.   

    能用strcpy(volume,nil)把数祖清空吗?
      

  5.   

    to zswang 您的方法可以,谢谢!
      

  6.   

    报'access violation  at 0x00000000:read of address oxoooooo'.process
    stopped.use step or Run to continue 
    我记得一般都是对不可写的内存执行写操作等等的时候的毛病啊!
    再说伴水的方法好使的话,实在是很有可能是因为内存的缘故而不是DLL.
    请仔细检查你前面VOLUME的定义和操作,
    如有问题请速贴上来让大家了解真相.
      

  7.   

    用半水的方法可以,但我不明白我以用GetMem对volume分配了内存,并且在Dll里除了strcpy外没有对volume 进行操作,从Dll回到delphi 我又用了freemem按道理应该没问题呀!Dll里的调用的第三方函数都没有问题的!这是什么道理了?
      

  8.   

    我也不知道为什么内存访问会有问题真害怕用GetMem、FreeMem老有问题缓冲变量(array[] of Char)解决先
      

  9.   

    var
      volume:PChar;
    ...
    GetMem(volume,260);
    ReturnJubCdLabel(1,volume);
    //这句改成ReturnJubCdLabel(1,volume^);试试。。
      

  10.   

    c++ 的声明不对, 要指明是stdcall:
    extern"C"__declspec(dllexport) int __stdcall ReturnJubCdLabel(int pSlot,char *pLabel)