English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 26 May 2014, 12:24   #1
Cowcat
Registered User
 
Join Date: Apr 2013
Location: Mallorca
Posts: 758
From gcc to vbcc.

Working on some big/old classic source code:

To the fellow coders: What are the key factors or things to look after to arrange gcc source to be compatible enough to work with vbcc? (I'm using posix lib from vbcc by the way)
Cowcat is offline  
Old 26 May 2014, 12:44   #2
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
If you work with gcc and want to keep it compatible with other compilers (like vbcc), use at least -std=c99, -ansi and -pedantic options to avoid gcc-specific extensions and keep the code clean.

If you work with vbcc and try to port a gcc source you will likely see the problems very soon.

If you have the time, try to remove all Posix stuff which has to be emulated. The gcc-version should compile with -noixemul and the vbcc-version shouldn't require PosixLib. A real Amiga program is always cleaner.
phx is offline  
Old 26 May 2014, 13:12   #3
Cowcat
Registered User
 
Join Date: Apr 2013
Location: Mallorca
Posts: 758
First is the makefile nightmare

I don't have nowadays any complete gcc stuff vbcc to me "is" the way to go.

Problems in the code are related to some calls to things like bzero, or fopen ,etc. So posix helps: No idea of how to implement all that (now).

Some of the object files need to be compiled with amitcp includes as something doesn't work with posix includes all the way to the different binaries (dlls)

I hacked my way to produce a binary: Of course it doesn't work but at least I does some output.

Complicated stuff
Cowcat is offline  
Old 26 May 2014, 13:25   #4
kamelito
Zone Friend
 
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 1,801
@PHX
a bit off topic but is VBCC better performance wise than GCC? Any comparison with newer version of GCC?

http://sun.hasenbraten.de/vbcc/index...iew=benchmarks

Kamelito
kamelito is offline  
Old 26 May 2014, 14:21   #5
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by Cowcat View Post
I don't have nowadays any complete gcc stuff vbcc to me "is" the way to go.
If we could only find the time to stabilize the current development for the next release. There is always a bug left to fix...

Quote:
Problems in the code are related to some calls to things like bzero, or fopen ,etc.
Code:
#define bzero(p,l) memset(p,0,l)
fopen is standard ANSI-C. Perhaps you're refering to Posix-open()? Use dos.library Open() instead, for unbuffered I/O.

Quote:
So posix helps: No idea of how to implement all that (now).
Any Unix system helps, where you can read about all those functions in the man pages.
phx is offline  
Old 26 May 2014, 14:27   #6
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by kamelito View Post
a bit off topic but is VBCC better performance wise than GCC?
Maybe still in some cases. Also depends on the CPU backend used.

Quote:
Any comparison with newer version of GCC?
I didn't make any comparison since many years. GCC has certainly improved with version 3 and 4. But it also became quite bloated. And the 68k backend starts to "bit-rot".
phx is offline  
Old 26 May 2014, 16:45   #7
Cowcat
Registered User
 
Join Date: Apr 2013
Location: Mallorca
Posts: 758
@phx
Located bzero Thanks! Maybe also "strdup" can be defined easily.

But others like stat, putenv, isort, mkdir .... maybe I will have to do an special "posix.o" with all in it.
Cowcat is offline  
Old 06 June 2014, 13:59   #8
Cowcat
Registered User
 
Join Date: Apr 2013
Location: Mallorca
Posts: 758
Can't figure out this:

Code:
#define	CRAP(x) (int)&(((something_t *)0)->x)

field_t fields[] = {
	{"whatever", CRAP(whatever),MORE},
};
gives me "initializer not a constant". Seems to work for gcc....
Cowcat is offline  
Old 06 June 2014, 14:11   #9
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
Code:
#include <stddef.h>

#define CRAP(x) (int)offsetof(something_t,x)
thomas is offline  
Old 06 June 2014, 14:45   #10
Cowcat
Registered User
 
Join Date: Apr 2013
Location: Mallorca
Posts: 758
Quote:
Originally Posted by thomas View Post
Code:
#include <stddef.h>

#define CRAP(x) (int)offsetof(something_t,x)
Awesome Thanks !

But now I have to figure out something like (anotherthing.other, x) ....seems like I need a ")" and a "}" expected. Just tried fast your recipe

EDIT: Sorry for (whatever.whatever)

Last edited by Cowcat; 06 June 2014 at 15:43.
Cowcat is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vbcc: no startup aragon Coders. C/C++ 2 16 February 2014 14:52
(Useless benchmark) Dhrystone on Sas C/Gcc/Vbcc alkis Coders. System 3 16 October 2013 13:03
Compiling CLib37 with VBCC 0.9 tnt23 Coders. General 2 29 July 2013 10:28
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:42.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08656 seconds with 13 queries