Hi everybody!
THE PLAN
After fiddling around with coloured tiny pictures the last year I thought it might be nice and new challenge to get the grips on coding with and for OS4.
As I consider myself as a bloody newbie there are at least three big obstacles that I have to conquer on my way to ultimate fame:
- learnig C (again)*,
- knowing the Amiga API (more then now and more about 4.x)**,
- understanding the SDK/IDE/GCC stuff.***
THE EQUIPMENT
Residing on my hard disks are
- the latest OS4 SDK,
- Simon's Codebench,
- Dietmar's Cubic IDE - already hacked to use the latest SDK (maybe I will some day do a full enviroment for the latest SDK like I did already for Modula-2),
- the full Amiga_Developer_CD_v2.1 copied to hard disk for quick access,
- some docs and tutorials from here and there.
THE FIRST PROJECT
I'm not good with learning something only from theory and/or RTFM - I need something I can bite into. So I decided to download Dave Norris' sources for "AISSView" (OS4Depot).
It is a program that didn't work with my OS4.1 setup for some time now (I already know why ;-)), I would like to use it and I have some ideas how to improve it. Further I already found some bugs (or I should say "programming quirks") in the source, which I would like to fix/overhaul.
Further it features: DOS operations, GUI stuff, user interactions, Tooltypes etc. and comes in nicely separated source and header files.
THE FIRST STEP(S)
My first aim is to make a clean compile of the source code - I would like to see how to build an executable. I am rather sure that Dave used an older SDK, so I would not be surprised, if something might *not* work.
I will compare the original binary and it's functions to the new compile - and hope, they will work the same. So here's my first question:
THE FIRST OBSTACLE
The compile of Dave's source did *not* work. This is what the build process said:
Yes, "select" is declared as bool in viewer.h. But why is that obscure "select.h" from the newlib includes playing a role here? I suppose it must have been "sub included" by something else. If I *errm* manipulate the "sys/select.h" the source happily compiles to an executable - but this is of course no solution.
What did I wrong? Compiler switches? Wrong includes? Where did I say to use newlib? Who did include that "select.h"? What did Dave what I didn't?
I hope somebody might give me a clue how to solve this - and be prepared, it won't be my last question! ;-)
Regards,
Frank
* I did my last sporadic C codes roughly 10-15 years ago - basically command line tools for Linux and some MS-DOS (really!) - never used this on Amiga (read: more than "HelloWorld").
** I have *some* very, very basic knowledge about the Amiga API - so building up structures for windows, scanning through Autodocs hunting for the right Tags etc. is something I did in the past. But nothing a real Amiga coder would assume as sufficient.
*** Yes, I used GCC already - in the stone age. So I don't know anything about the newer incarnations and especially nothing about any special switches for our enviroment.
SDK:gcc/bin/gcc -c main.c -o main.o -lraauto -lauto In file included from main.c:9: viewer.h:71: error: 'select' redeclared as different kind of symbol /SDK/newlib/include/sys/select.h:84: error: previous declaration of 'select' was here make: *** [main.o] Error 1
#include <proto/blalba.h>
and __USE_INLINE__ (see next answer for details). If you want to use "normal" functions (without worring about IFace), then just follow to that 2 rulz for all the time: 1. always use __USE_INLINE__ I.e. it can be in source code itself: #define __USE_INLINE__ 1 or , in the command line strings (which is a bit better imho , because only makefile/compile line need to change): gcc balbalablabl -D__USE_INLINE__ blablalb 2. Use all the time where it possible#include <proto/blabla.h>
No clib2/ anymore, nothing like this. Just all the time "proto", and if only you not have some defines or tags, then, include need it one (like for example for cybergraphics, or for some dos types). By this way, only one time when IFace still need it, it when you open library. I.e. you still do plain OpenLibrary call, but later, use GetInterface for IFaceBase stuff. And by this way, everything will be the same as you code on os3, just with new functions. All the ports from os3 code will works fine like this. New programms also will works fine which done in this way as well.