[fpc-pascal] Porting code from Windows D2007, missing Windows functions
Sven Barth
pascaldragon at googlemail.com
Thu Jul 14 07:55:05 CEST 2016
Am 14.07.2016 07:08 schrieb "Bo Berglund" <bo.berglund at gmail.com>:
>
> I am porting a Delphi2007 utility from Windows to Linux (Raspbian
> Jessie). It uses a unit I have downloaded from the web, which was said
> to support FreePascal too.
>
> But now I am getting a number of missing identifier errors as follows
> Function calls:
> - SetFilePointer
> - GetFileTime
> - FileTimeToLocalFileTime
> - FileTimeToDosDateTime
> - SetEndOfFile
>
> Constants:
> - FILE_CURRENT
> - INVALID_HANDLE_VALUE
>
> It seems like these are defined in Windows and now in FPC they are
> elsewhere.
Those functions and constants don't exist on non-Windows. Try to convert
your code to one of the abstractions Free Pascal (and also Delphi)
provides, e.g. FileOpen() and friends or TFileStream.
> The uses clause of the unit has the following content:
>
> uses
> {$ifdef MSWINDOWS}
> Windows,
> {$else}
> LibC, <== Error here, not found
> Types,
> {$endif}
> SysUtils;
>
> It could not find LibC and when I asked on the Lazarus list I got a
> reply to try Unix and/or BaseUnix instead. But this does not work so I
> guess these functions are in another FPC unit somewhere.
>
> What should I add to the uses clause in place of LibC to get it to
> compile on Linux?
The LibC unit only exists on i386-linux and only for compatibility for
Kylix. Other than that you should consider that unit as deprecated and
instead use units like Unix, BaseUnix or Linux, depending on what
functionality you need.
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160714/a2a33713/attachment.html>
More information about the fpc-pascal
mailing list