Menu

CompilingProject

Romiras

Note

This document is a draft version.

Sample Hello module

For example, we create a module Hello what is part of subsystem Priv (e.g. it located at path Priv/Mod/Hello.cp).

Hello.cp

MODULE PrivHello;
IMPORT Out;
BEGIN
  Out.String ("Hello world!"); Out.Ln
END PrivHello.

Project

Template for project

[Project]
Name=<project name>

[Compiler]
Modules=<ModuleName1 ModuleName2 ModuleNameN>
Options=<compiler options>

[Linker]
InterfaceModules=<list of modules, like: Kernel$+ Math Strings Console WinConsole HostInit Init Out Hello#>
OutputMode=<name of output file e.g. demo.exe, mpeg4.plg, libexport.so>

Parameters

CompilerOptions

  • checks - (0): Enable index range checks and type guard checks (inxchk, typchk & ptrinit in DevCPC486) (default).
  • allchecks - (1): Enable overflow checks and range checks (ovflchk & ranchk in DevCPC486).
  • assert - (2): Execute ASSERT instructions (assert in DevCPV486) (default).
  • obj - (3): Enable code output (outObj in DevCPE) (default except in interface modules).
  • ref - (4): Record references to variables (outRef in DevCPE) (default).
  • allref - (5): Record more references, about RECORDs & static ARRAYs (outAllRef & outURef in DevCPE) (default).
  • srcpos - (6): Record positions in source (outSrc in DevCPE) (default).
  • hint - (29): Insert additional error marks (warnings) in source text (hint in DevCompiler.Module & hints in DevCPC486).
  • oberon - (30): Compatibility with Oberon, relative to the use of IN and OUT (oberon in DevCPM.options).
  • errorTrap - (31): Makes the compiler trap (HALT(100)) if an error in the source is detected (trap in DevCPM.options).

Default compiler options are {checks, assert, obj, ref, allref, srcpos, signatures}.

CompilerOptions is a combination of options in one string. Valid characters are '-', '!', '+', '$', '?' and '@'.

  • first '-' excludes srcpos from compiler options.
  • second '-' excludes allref from compiler options.
  • third '-' excludes ref from compiler options.
  • fourth '-' excludes obj from compiler options.
  • first '!' excludes assert from compiler options.
  • second '!' excludes checks from compiler options.
  • '+' includes allchecks into compiler options.
  • '?' includes hint into compiler options.
  • '@' includes errorTrap into compiler options.
  • '$' includes oberon into compiler options.

Paths

All paths are relative to root directory of all subsystems.

Sample Project

In order to build program for native OS you need create a project document for module "PrivHello".

Hello.prj

[Project]
Name=<project name>

[Compiler]
Modules=PrivHello
Options=<compiler options>

[Linker]
InterfaceModules=Kernel$+ Math Strings Console WinConsole HostInit Init Out PrivHello
OutputMode=Exe
OutputFile=hello.exe

Related

Wiki: Main_Page

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.