[fpc-pascal] FPC 2.4.1 with library that requires old libc unit.

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Apr 23 09:45:39 CEST 2010


Hi,

I'm trying to update a set of database components (FBLib) used with tiOPF.
In FPC 2.2.0 (32bit linux) everything compiled and worked fine. Today I
tried to compile my latest version of FBLib (as is found in tiOPF
repository) with FPC 2.4.1 (64bit linux).  I don't know if the following
problems are related to 32bit -> 64bit switch or because of FPC 2.2.0 ->
FPC 2.4.1 switch.

1) First I had the problem that FPC couldn't find 'Libc' unit used in the
uses clause. No idea why - maybe Libc unit is only 32bit?  Anyway, I
replaced 'Libc' in uses clause with 'baseunix' and continued...

2) This got me a bit further, to the code shown below. Is there a baseunix
equivalent to Libc.mblen()? Can anybody help me resolve this compilation issue?

This URL describes what mblen() does:
  http://www.delorie.com/djgpp/doc/libc/libc_558.html

--------------------------------

function TFBLScript.CStrNextChar(const AStr: PChar): PChar;
{$IFDEF UNIX}
var
  CharLen: Integer;
{$ENDIF}
begin
  {$IFDEF UNIX}
  CharLen := Libc.mblen(AStr, MB_CUR_MAX);     // <<-----
  if (CharLen = -1)
    then CharLen := 1;
  Result := AStr + CharLen;
  {$ELSE}
  Result := CharNext(AStr);
  {$ENDIF}
end;
--------------------------------



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list