Skip to content

Repository files navigation

MFPC - Mini FPC

Several slightly truncated and modified Free Pascal units.

Modifications were made to remove unnecessary classes for console applications (eg. TComponent, TReader, TWriter). TStringList replaced by TJPStrList from JPLib/Containers.

Example

Lazarus console application:

program console_mfpc;
//IMPORTANT: Add "$(LazarusDir)\components\lazutils" to project include files (-Fi){$mode objfpc}{$H+}{$IFDEF MSWINDOWS}{$APPTYPE CONSOLE}{$ENDIF}uses
SysUtils, MFPC.LazUtils.LazUTF8, MFPC.Classes.Lists;
type
PData = ^TData;
TData = record
No: integer;
Str: string;
end;
var
List: TM_List;
Data: PData;
i: integer;
begin
List := TM_List.Create;
try// Add 10 items to the listfor i := 1to10dobegin
New(Data);
Data^.No := i;
Data^.Str := 'Str ' + IntToStr(i);
List.Add(Data);
end;
// Display all datafor i := 0to List.Count - 1dobegin
Data := List[i];
ifnot Assigned(Data) then Continue;
Writeln('Item no: ', Data^.No, ' Value: ', Data^.Str);
end;
// Free datafor i := 0to List.Count - 1dobegin
Data := List.Items[i];
if Assigned(Data) then Dispose(Data);
end;
finally
List.Free;
end;
end.

The size of the compiled executable (Lazarus 1.9.0 + FPC 3.1.1):

TargetFPC without mod.Using MFPCDifference
Win 32-bit207.00 KB130.50 KB-76.50 KB
Win 64-bit279.50 KB145.50 KB-134.00 KB
Lin 32-bit192.86 KB103.63 KB-89.23 KB
Lin 64-bit258.08 KB134.88 KB-123.20 KB

About

Several slightly truncated and modified Free Pascal units. Modifications were made to remove unnecessary classes for console applications (eg. TComponent, TReader, TWriter).

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages