function rfmInitial(WorkPaths: PChar;      //[IN] 工作盘列表  D:\1\;E:\;F:\;D:\;z:\abc
                    CurPath: PChar;           //IN] 当前工作盘  C:\
                    MinDiskSpace: integer;    //IN] 剩余空间
                    DeleteDiskSpace: integer; //IN] 删除空间
  varWorkPahts: PChar;         //[OUT] 返回工作盘列表
  varCurPath: PChar;           //[OUT] 返回工作盘
                   ): Integer; stdcall;
返回值: 0: 失败
        1: 成功
        2: 当前工作盘在工作列表不存在,已加到工作列表
        3: 工作列表中有些路径不存在, 返回已存在的工作列表
        4: 工作盘无效, 取工作盘列表中最前的有效路径说明: 此时创建删除文件, 检测工作盘空间线程function rfmClose(WorkPaths: PChar;         //[OUT] 工作盘列表  D:\; E:\ F:\; D:\;z:\abc
CurPath: PChar          //[OUT] 当前工作盘
     ): integer; stdcall;
返回值: 0: 失败
        1: 成功说明: 此时释放线程

解决方案 »

  1.   

    library Main_P;{ Important note about DLL memory management: ShareMem must be the
      first unit in your library's USES clause AND your project's (select
      Project-View Source) USES clause if your DLL exports any procedures or
      functions that pass strings as parameters or function results. This
      applies to all strings passed to and from your DLL--even those that
      are nested in records and classes. ShareMem is the interface unit to
      the BORLNDMM.DLL shared memory manager, which must be deployed along
      with your DLL. To avoid using BORLNDMM.DLL, pass string information
      using PChar or ShortString parameters. }uses
      SysUtils,
      Classes;{
    把一个字符串,左边补零到intFillCount长度
    }function funLeftFill(str: string; intFillCount: integer; intVec: Boolean = True): string; stdcall;
    var i: integer;
    begin
      i := 0;  for i := 1 to intFillCount - length(str) do
        if intVec then
          str := '0' + str
        else
          str := str + '0';
      Result := str;
    end;{
    把一个字符串IP,转化成INT64格式。
    }function funIPtoInteger(str: string): int64; stdcall;
    var intDotCount: integer;
      strSec: array[1..4] of string;
      i: integer;
    begin
      i := 0;
      intDotCount := 0;  for i := 0 to length(str) - 1 do
      begin
        if str[i] = '.' then
          intDotCount := intDotCount + 1;
      end;
      if intDotCount - 3 <> 0 then Result := 0;
      for i := 1 to 3 do
      begin
        strSec[i] := Copy(str, 0, Pos('.', str) - 1);
        str := Copy(str, Pos('.', str) + 1, length(str) - 1);
      end;  strSec[4] := str;  for i := 1 to 4 do
      begin
        strSec[i] := funLeftFill(strSec[i], 3);  end;  str := '';  for i := 1 to 4 do
        str := str + strSec[i];  Result := strtoint64(str);
    end;
    {$R *.RES}
    exports
      funIPtoInteger, funLeftFill;
    begin
    end.
      

  2.   

    把你的函数按照这格式放到这代码中,ctrl+f9编译一下好了
      

  3.   

    呵呵,一楼的,你置borland的那段注释于不顾啊,如果用到了string参数传送数据,就必须在uses第一行uses ShareMem.......
      

  4.   

    所以,用PChar可以省却很多麻烦