[SOLVED] create system unit from scratch lazarus / 64-FPC development ---------------------------------------------------------------------- Key-Real · 2024-04-18 11:01 I looked at other implementation and the first thing all do is to include systemh.inc, so i do the same: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit system;{$MODE FPC}interface {$I systemh.inc} implementationend. but this gives me: Compiling ./rtl/ps1/system.pp systemh.inc(23,2) Error: Mode switch "OBJFPC" not allowed here filerec.inc(33,17) Error: Identifier not found "THandle" filerec.inc(33,24) Error: Error in type definition textrec.inc(38,17) Error: Identifier not found "THandle" textrec.inc(38,24) Error: Error in type definition systemh.inc(867,17) Error: Identifier not found "TThreadID" systemh.inc(867,26) Error: Error in type definition mathh.inc(200,53) Fatal: Syntax error, ")" expected but "=" found Fatal: Compilation aborted ---------------------------------------------------------------------- Key-Real · 2024-04-18 11:14 OK, I can't define {$MODE FPC} ---------------------------------------------------------------------- Laksen · 2024-04-18 11:28 Those missing types are defined a platform specific sysosh.inc For something like the PS1 maybe take a look at how the embedded platform structures the system unit and the sys*.inc contents ---------------------------------------------------------------------- KodeZwerg · 2024-04-18 12:02 To compare it with a hospital, you are currently doing a heart transplantation and you just cut off every connection. So be a good surgeon and put back the missing parts or the heart stay dead. ---------------------------------------------------------------------- Key-Real · 2024-04-19 08:34 I gonna implement only the minimal requered code in the system unit pls explain what  type 1)  jmp_buf 2) TExceptAddr 3) TGuid do and what is minimal implementation of thouse. I found https://wiki.lazarus.freepascal.org/System_unit but there is no detailed explanation ---------------------------------------------------------------------- Laksen · 2024-04-19 08:53 jmp_buf is a record used to store the state of the CPU for the setjmp and longjmp procedures. This functionality is used for exception handling. They are already implemented for MIPS in rtl/mips/setjump*.inc which is included by systemh.inc TExceptAddr is as the name hints also used for exception handling and implemented in a generic way shared by all the targets in excepth.inc included by systemh.inc TGuid stores a GUID. The compiler needs to point to it during compilation when GUIDs are needed. Also implemented in a generic manner in objpash.inc included by systemh.inc The key to implementing a systems unit is to get the proper defines, paths and system specific dummy functionality (usually residese in sys*/tthread/check.inc files) implemented. There's no documentation but you should see how other system units are structured