![]() |
![]() |
#1 |
Registered User
Join Date: Aug 2003
Location: hamburg
Posts: 56
|
vbcc: no startup
I'm trying to figure out how to work with vbcc's minstartup.o.
If I compile the hello_min.c example from the manual, it links correctly, but when running this from CLI results in a 80000004 guru message. I'm running under OS 3.1. Compiler and linker are invoked with Code:
vc -sc -sd -O2 hello_min.c -o hello_min -nostdlib $VBCC/targets/m68k-amigaos/lib/minstart.o -lamigas And why do I need to link with amiga.lib? I thought that if I use pragmas and a custom _main(), amiga.lib would not be necessary? |
![]() |
![]() |
#2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,025
|
You have to put minstart.o before hello_min.c in the command line. If you link without standard lib, then the first object module becomes the entry to the program. If hello_min is first, then main becomes the entry and not minstart as intended.
Given that minstart.o does not do much anyway, it's completely superfluous IMHO. If this is your hello_min.c: Code:
#include <proto/exec.h> #define __NOLIBBASE__ #include <proto/dos.h> struct Library *DOSBase; int main (void) { if (DOSBase = OpenLibrary ("dos.library",36)) { Printf ("Hello World!\n"); CloseLibrary (DOSBase); } return (RETURN_OK); } Code:
#define __NOLIBBASE__ #include <proto/exec.h> #include <proto/dos.h> struct Library *SysBase; struct Library *DOSBase; __saveds int main (void) { SysBase = *((struct Library **)4); if (DOSBase = OpenLibrary ("dos.library",36)) { Printf ("Hello World!\n"); CloseLibrary (DOSBase); } return (RETURN_OK); } |
![]() |
![]() |
#3 |
Registered User
Join Date: Aug 2003
Location: hamburg
Posts: 56
|
Thanks thomas, that helped a lot.
So this is now my initial program: Code:
/* minimal startup code vc -sc -sd -O2 $VBCC/targets/m68k-amigaos/lib/minstart.o hello_min.c -o hello_min -nostdlib */ #include <proto/exec.h> #include <proto/dos.h> struct DosLibrary *DOSBase; main() { if(DOSBase=(struct DosLibrary*)OpenLibrary("dos.library",0)){ Write(Output(),"Hello, world!\n",14); CloseLibrary((struct Library *)DOSBase); } return 0; } I changed your version to this: Code:
/* no startup vc -nostdlib -sc -sd -O2 hello_min3.c -o hello_min3 */ #define __NOLIBBASE__ #include <proto/exec.h> #include <proto/dos.h> struct Library *SysBase; struct Library *DOSBase; __saveds int main (void){ SysBase = *((struct Library **)4L); if (DOSBase = OpenLibrary ("dos.library",0L)){ Write(Output(),"Hello, world!\n",14); CloseLibrary (DOSBase); } return (RETURN_OK); } Compared with the SAS/C Example2 (124 bytes) this is fine. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compiling CLib37 with VBCC 0.9 | tnt23 | Coders. General | 2 | 29 July 2013 10:28 |
Using timer.device in C (VBCC) | DBAlex | Coders. General | 2 | 28 June 2011 22:10 |
VBCC as cross sompiler under Linux | gilgamesh | Coders. General | 13 | 21 March 2010 12:43 |
VBCC 0.8j for Windows | hitchhikr | Coders. General | 11 | 09 October 2008 00:58 |
Kickstart 1.3 and GCC or VBCC? | cdoty | Coders. General | 1 | 23 April 2005 06:10 |
|
|