Table of Contents

MorphOS SDK

Installing the SDK

The official MorphOS SDK provides a complete environment for creating programs for MorphOS.

It contains the following components:

The first step of installation is to download the SDK archive from the morphos.net site, or by clicking this direct link. The SDK is delivered as a LhA archive, which must be depacked before proceeding. The easiest way is to open a context menu for the archive (with the right mouse button in an Ambient window) and choose Extract. After depacking a directory named morphossdk is created with an Installer application and a big file named sdk.pack inside. Installation is started by running Installer. The only user choice that is needed here is to choose an installation directory. Then there is some time spent watching the progress bar...

After the installation a system reboot may be needed to update system assigns and paths.

There is no programmer editor in the list above. An advanced programmer editor Scribble is, starting from MorphOS 3.1, included with the operating system. Scribble is based on a well known Scintilla component. When the SDK is installed, additional features are added to it automatically, like dynamic code parsing, calltips with function arguments and structure members, fast access to the system API documentation and more.

Choosing a Compiler

As mentioned above, the SDK delivers two GCC compilers: an old but trusty 2.95.3 one, and the modern 4.4.5. There is a tool named GCCSelect in the SDK, which allows fast switching between compilers. Just type in a shell window

GCCSelect 2.95.3

or

GCCSelect 4.4.5

to change the current compiler. GCCSelect works by making symbolic links to the proper version of GCC and its tools, so the compiler is always called as gcc or g++, regardless of the version chosen currently.

Which one to choose? It depends on the code compiled and other constrains. Here is some guidance:

My general advice is to use GCC 4 and only switch to GCC 2 if needed.

One can check which compiler is currently active using the −v compiler option,

which displays the compiler version and build options:
gcc -v

The last line of output shows the GCC version.

Standard C and C++ Libraries

These standard libraries are parts of the C and C++ language specifications respectively. They mainly deliver file and console input/output functions, mathematic functions and string operations. The C++ library also provides a set of basic container classes.

There are two ways to access these libraries on MorphOS. The first (and default) one is by using a MorphOS shared library; ixemul.library. As the name suggests, this library tries to provide some Unix environment emulation on MorphOS, which, other than the standard libraries, includes large part of POSIX standard and some other commonly used functions. ixemul.library is usually used for porting big projects from the Unix/Linux world, for example it is used by GCC itself and many other tools in the SDK.

The second way is to use libnix (as in; lib no ixemul). In contrast to ixemul.library, libnix is statically linked with the application. This is the preferred way for providing standard libraries for MorphOS native applications. It is achieved by passing the −noixemul flag to the compiler and the linker. libnix delivers full C and C++ standard libraries, but its POSIX implementation is less complete.

Another alternative is to not use standard libraries at all. It may sound crazy at first, but the MorphOS native API provides complete file and console I/O as well as some string manipulation functions and many mathematic functions. Using the native API makes applications faster and smaller in size. On the other hand code using the MorphOS API directly is not portable to non-Amiga(like) systems. A −nostdlib compiler option instructs the compiler to not link the code with the standard library. Note that this requires also writing your own custom startup code.