char*  ===> Pchar
short* ===> ^ShortInt;
*     ===> Pointer;

解决方案 »

  1.   

    我试了一下,但是只是在动态库里头改了,在Delphi中没有改动。
    dll接口 
    extern "C"
    {
        int _declspec(dllexport) add_2(short *c)
        {
           *c=100;
           return *c;
         }
    }Delphi的主要编码type
      TPInt = ^Shortint;
      TInStr_2 = function(a:TPInt): Integer;var
      pC: TPInt;
      ret: Integer;
    ...procedure TForm1.Button1Click(Sender: TObject);
    begin
            Moudle := Loadlibrary('d:\tmp\dll.dll');        PFunc := GetProcAddress(Moudle,'add_2');        new(pC);
            pC^ := 0;
            ShowMessage(IntToStr(pC^));    { '0' is output here }        ret := TInstr_2(PFunc)(pC);        ShowMessage(IntToStr(pC^));    { '100' should be output , but '0' is output}
            ShowMessage(IntToStr(ret));        Freelibrary(Moudle);
    end;
      

  2.   

    好象应该这么样:
    var
      c:integer;ret := TInstr_2(PFunc)(@C);
      

  3.   

    感谢lz_0618的建议,可我试了一下,还是不行呀 ,真是奇怪?? :-(以下为部分代码
    c := 0;ShowMessage(IntToStr(c));
    TInstr_2(PFunc)(@c);
    ShowMessage(IntToStr(c));  { '100' should be output , but '0' is output}
     
      

  4.   

    使用静态方式调用,以
    var a: Integer ; b: PChar 
    方式调用成功,但动态调用还是失败。