Contents Menu Expand Light mode Dark mode Auto light/dark mode
The GNU Modula-2 Compiler 13.0.1 (experimental 20220101) documentation
Logo
The GNU Modula-2 Compiler 13.0.1 (experimental 20220101) documentation
  • Overview of GNU Modula-2
    • What is GNU Modula-2
    • Why use GNU Modula-2
    • Release map
    • News
    • How to get source code using git
    • GNU Modula-2 Features
    • Documentation
    • Regression tests for gm2 in the repository
    • Limitations
    • Objectives
    • FAQ
      • Why use the C++ exception mechanism in GCC, rather than a bespoke Modula-2 mechanism?
    • Community
    • Other languages for GCC
    • Papers and talks
  • Using GNU Modula-2
    • Example compile and link
    • Compiler options
    • GNU Modula-2 related environment variables
    • Elementary data types
    • Permanently accessible base procedures.
      • Standard procedures and functions common to PIM and ISO
      • ISO specific standard procedures and functions
    • GNU Modula-2 supported dialects
      • Integer division, remainder and modulus
    • Exception implementation
    • How to detect runtime problems at compile time
    • GNU Modula-2 language extensions
      • Optional procedure parameter
    • Type compatibility
      • Expression compatibility
      • Assignment compatibility
      • Parameter compatibility
    • Unbounded by reference
    • Building a shared library
    • How to produce swig interface files
      • Limitations of automatic generated of Swig files
    • How to produce a Python module
    • Interfacing GNU Modula-2 to C
    • Interface to assembly language
    • Data type alignment
    • Packing data types
    • Accessing GNU Modula-2 Built-ins
    • The PIM system module
    • The ISO system module
  • Licence of GNU Modula-2
  • EBNF of GNU Modula-2
  • PIM and ISO library definitions
    • Base libraries
      • gm2-libs/ASCII
      • gm2-libs/Args
      • gm2-libs/Assertion
      • gm2-libs/Break
      • gm2-libs/Builtins
      • gm2-libs/COROUTINES
      • gm2-libs/CmdArgs
      • gm2-libs/Debug
      • gm2-libs/DynamicStrings
      • gm2-libs/Environment
      • gm2-libs/FIO
      • gm2-libs/FormatStrings
      • gm2-libs/FpuIO
      • gm2-libs/GetOpt
      • gm2-libs/IO
      • gm2-libs/Indexing
      • gm2-libs/LMathLib0
      • gm2-libs/LegacyReal
      • gm2-libs/M2Dependent
      • gm2-libs/M2EXCEPTION
      • gm2-libs/M2LINK
      • gm2-libs/M2RTS
      • gm2-libs/MathLib0
      • gm2-libs/MemUtils
      • gm2-libs/NumberIO
      • gm2-libs/OptLib
      • gm2-libs/PushBackInput
      • gm2-libs/RTExceptions
      • gm2-libs/RTint
      • gm2-libs/SArgs
      • gm2-libs/SCmdArgs
      • gm2-libs/SEnvironment
      • gm2-libs/SFIO
      • gm2-libs/SMathLib0
      • gm2-libs/SYSTEM
      • gm2-libs/Scan
      • gm2-libs/Selective
      • gm2-libs/StdIO
      • gm2-libs/Storage
      • gm2-libs/StrCase
      • gm2-libs/StrIO
      • gm2-libs/StrLib
      • gm2-libs/StringConvert
      • gm2-libs/SysExceptions
      • gm2-libs/SysStorage
      • gm2-libs/TimeString
      • gm2-libs/UnixArgs
      • gm2-libs/cbuiltin
      • gm2-libs/cgetopt
      • gm2-libs/cxxabi
      • gm2-libs/dtoa
      • gm2-libs/errno
      • gm2-libs/gdbif
      • gm2-libs/ldtoa
      • gm2-libs/libc
      • gm2-libs/libm
      • gm2-libs/sckt
      • gm2-libs/termios
      • gm2-libs/wrapc
    • PIM coroutine support
      • gm2-libs-coroutines/Debug
      • gm2-libs-coroutines/Executive
      • gm2-libs-coroutines/KeyBoardLEDs
      • gm2-libs-coroutines/SYSTEM
      • gm2-libs-coroutines/TimerHandler
    • M2 ISO Libraries
      • gm2-libs-iso/COROUTINES
      • gm2-libs-iso/ChanConsts
      • gm2-libs-iso/CharClass
      • gm2-libs-iso/ClientSocket
      • gm2-libs-iso/ComplexMath
      • gm2-libs-iso/ConvStringLong
      • gm2-libs-iso/ConvStringReal
      • gm2-libs-iso/ConvTypes
      • gm2-libs-iso/EXCEPTIONS
      • gm2-libs-iso/ErrnoCategory
      • gm2-libs-iso/GeneralUserExceptions
      • gm2-libs-iso/IOChan
      • gm2-libs-iso/IOConsts
      • gm2-libs-iso/IOLink
      • gm2-libs-iso/IOResult
      • gm2-libs-iso/LongComplexMath
      • gm2-libs-iso/LongConv
      • gm2-libs-iso/LongIO
      • gm2-libs-iso/LongMath
      • gm2-libs-iso/LongStr
      • gm2-libs-iso/LongWholeIO
      • gm2-libs-iso/LowLong
      • gm2-libs-iso/LowReal
      • gm2-libs-iso/LowShort
      • gm2-libs-iso/M2EXCEPTION
      • gm2-libs-iso/M2RTS
      • gm2-libs-iso/MemStream
      • gm2-libs-iso/Preemptive
      • gm2-libs-iso/Processes
      • gm2-libs-iso/ProgramArgs
      • gm2-libs-iso/RTco
      • gm2-libs-iso/RTdata
      • gm2-libs-iso/RTentity
      • gm2-libs-iso/RTfio
      • gm2-libs-iso/RTgen
      • gm2-libs-iso/RTgenif
      • gm2-libs-iso/RTio
      • gm2-libs-iso/RandomNumber
      • gm2-libs-iso/RawIO
      • gm2-libs-iso/RealConv
      • gm2-libs-iso/RealIO
      • gm2-libs-iso/RealMath
      • gm2-libs-iso/RealStr
      • gm2-libs-iso/RndFile
      • gm2-libs-iso/SIOResult
      • gm2-libs-iso/SLongIO
      • gm2-libs-iso/SLongWholeIO
      • gm2-libs-iso/SRawIO
      • gm2-libs-iso/SRealIO
      • gm2-libs-iso/SShortIO
      • gm2-libs-iso/SShortWholeIO
      • gm2-libs-iso/STextIO
      • gm2-libs-iso/SWholeIO
      • gm2-libs-iso/SYSTEM
      • gm2-libs-iso/Semaphores
      • gm2-libs-iso/SeqFile
      • gm2-libs-iso/ServerSocket
      • gm2-libs-iso/ShortComplexMath
      • gm2-libs-iso/ShortIO
      • gm2-libs-iso/ShortWholeIO
      • gm2-libs-iso/SimpleCipher
      • gm2-libs-iso/StdChans
      • gm2-libs-iso/Storage
      • gm2-libs-iso/StreamFile
      • gm2-libs-iso/StringChan
      • gm2-libs-iso/Strings
      • gm2-libs-iso/SysClock
      • gm2-libs-iso/TERMINATION
      • gm2-libs-iso/TermFile
      • gm2-libs-iso/TextIO
      • gm2-libs-iso/WholeConv
      • gm2-libs-iso/WholeIO
      • gm2-libs-iso/WholeStr
      • gm2-libs-iso/wrapsock
      • gm2-libs-iso/wraptime
    • PIM and Logitech 3.0 Compatible
      • gm2-libs-pim/BitBlockOps
      • gm2-libs-pim/BitByteOps
      • gm2-libs-pim/BitWordOps
      • gm2-libs-pim/BlockOps
      • gm2-libs-pim/Break
      • gm2-libs-pim/CardinalIO
      • gm2-libs-pim/Conversions
      • gm2-libs-pim/DebugPMD
      • gm2-libs-pim/DebugTrace
      • gm2-libs-pim/Delay
      • gm2-libs-pim/Display
      • gm2-libs-pim/ErrorCode
      • gm2-libs-pim/FileSystem
      • gm2-libs-pim/FloatingUtilities
      • gm2-libs-pim/InOut
      • gm2-libs-pim/Keyboard
      • gm2-libs-pim/LongIO
      • gm2-libs-pim/NumberConversion
      • gm2-libs-pim/Random
      • gm2-libs-pim/RealConversions
      • gm2-libs-pim/RealInOut
      • gm2-libs-pim/Strings
      • gm2-libs-pim/Termbase
      • gm2-libs-pim/Terminal
      • gm2-libs-pim/TimeDate
    • Indices
Back to top
Edit this page

GNU Modula-2 related environment variables#

This section descibes the environment variables used by GNU Modula-2 and how they can be used to switch between releases of the compiler. Other environment variables can be set to modify the default library path. Initially we will consider environment variables most likely used by the end user. These two environment variables are GM2IPATH and GM2OPATH.

For example suppose a compile and link on the command line looks like this:

$ gm2 -g -c -I. -I../project -I../project/unix foo.mod
$ gm2 -fonlylink -g -I. -I../project -I../project/unix \
  -fobject-path=../project/obj -Iobject-path=../project/unix/obj \
  -I. foo.mod

they can be simplified by utilising two environment variables to do exactly the same compile and link.

$ export GM2IPATH=../project:../project/unix
$ export GM2OPATH=../project/obj:../project/unix/obj
$ gm2 -g -I. foo.mod

It is important to note that the two environment variables GM2IPATH and GM2OPATH have a lower priority than any -I or -fobject-path= command line option. The search order for compiling and linking is: command line switches followed by environment variable paths followed by default runtime libraries or Modula-2 dialect libraries. If in doubt include the -v option to see the search path used between the compiler subcomponents.

Next
Elementary data types
Previous
Compiler options
Copyright © 2022 Free Software Foundation, Inc.
Made with Sphinx and @pradyunsg's Furo
Last updated on Nov 07, 2022