//Delphi DLL函数
function GetExpireDateBySN(const AcitveSN: PChar): PChar; stdcall;
var
  Str: string;
  D: Integer;
begin
  Str := StrPas(AcitveSN);
  Str := UnEncrypt(Str);
  Str := RightStr(Str, 5);
  D := StrToInt(Str);
  Str := FormatDateTime('YYYY-MM-DD', D);
  Result := PChar(Str);
end;function GetPosNumBySN(const ActiveSN: PChar): Integer; stdcall;
var
  Str: string;
begin
  Str := StrPas(ActiveSN);
  //  ShowMessage(Str);
  Str := UnEncrypt(Str);
  Str := LeftStr(Str, 6);
  Str := RightStr(Str, 2);
  try
    Result := StrToInt(Str);
  except
    Result := 0;
  end;
end;//BCB中的代码,我用是静态加载的,在头文件中申明如下extern "C" char* __stdcall GetExpireDateBySN(char* ActiveSN);
extern "C" int __stdcall GetPosNumBySN(char* AcitveSN);//调用时如下
int PosNum;
WideString ExpireDate;
WideString ActiveCode="8989380234982308"
PosNum=GetPosNumBySN(AnsiString(g_ActiveCode).c_str());
ExpireDate=GetExpireDateBySN(AnsiString(g_ActiveCode).c_str());
Dll用delphi调用一点问题也没有,但是用BCB调用 ,却得到不同的结果。