This blog has been retired and its content was moved to a new Amiga-friendly site. Please visit: https://developer.amigaos3.net/
Although its development has been discontinued some years after Commodore went under, SAS/C Version 6 still is one of the best and recommendable C-compilers for classic AmigaOS development until today.
If you don't have the package, you may find it second hand or on the net. The extensive manual is a must read, comes in two large volumes and can be found here and here. We won't cover the installation of the compiler in this article, so please refer to the manual instead. Also please make sure to apply all updates up to Version 6.58.
When the compiler's installation script has concluded and you reboot for the first time, have a look at the S:User-Startup file. It should have the following additions, if you installed the compiler to the "Work" device/volume:
;BEGIN SAS/C assign sc: Work:sc assign lib: sc:lib assign include: sc:include assign cxxinclude: sc:cxxinclude path sc:c add ;END SAS/C
The files which need to be replaced are found in the directories pointed to by the "lib:" and "include:" assignments.
Start with the files which are used by the compiler and its assembler and delete only those which will be replaced by the 3.2 header files:
delete all include:clib delete all include:datatypes delete all include:devices delete all include:diskfont delete all include:dos delete all include:exec delete all include:gadgets delete all include:graphics delete all include:hardware delete all include:intuition delete all include:libraries delete all include:pragmas delete all include:prefs delete all include:proto delete all include:resources delete all include:rexx delete all include:utility delete all include:workbench delete include:all.gst delete include:all.gst.info
Now change to the directory where you placed the NDK's drawer and copy the replacement files from "NDK3.2" to the "include:" directory:
copy NDK3.2/Include_H/#? include: all copy NDK3.2/Include_I/#? include: all
Finally, copy the new link libraries:
copy NDK3.2/lib/#?.lib lib:
And that should be it. :-)
Note that the "include:all.gst" file is deleted as a precaution so that you do not use it by mistake. It contains all the old Kickstart/Workbench 3.1 header files in a precompiled form which can be helpful to cut compilation time. But we just replaced all the 3.1 header files with the 3.2 versions...
I recommend not to use "include:all.gst" file but to generate that precompiled global symbol table file in each of your projects as needed. The compiler options you use to generate these header files may have an impact on what is generated, and that may not be a file which works well with a different set of compiler options.
Let's enter a small C program to verify the procedure. You can use any text editor of your choice, but we'll use TextEdit now to create the file for demonstration purposes:
Textedit HelloWorld.c
Enter the following lines:
#include <dos/dos.h> #include <proto/dos.h> int main() { Printf("Hello, World!\n"); return(RETURN_OK); }
Save, close Textedit and compile & link the program with:
SC LINK HelloWorld.c
Comments
Post a Comment