Partner sites: Aminet - Amiga downloadsIntuitionBase - Amiga guidesAmigaNN - Amiga newsAmiFund - Sponsor projects

[Y]UtilityBase
Your guide to Amiga development
Not logged in
  HomeProjectsForumArticlesResourcesLinksChatAbout 
Search
Login
Username:
Password:
Register now!
Forgot your password?
Aminet - Development
Draco-src.lha (dev/lang)
peg-v0.1.4.tar.gz (dev/c)
peg-0.1.4-src.tar.gz (dev/c)
batari_Basic.lha (dev/cross)
pixman-src_aros.lha (dev/lib)
pixman_i386-aros.lha (dev/lib)
cairo-1.5.8-src_aros.lha (dev/lib)
cairo-1.5.8_i386-aros.lha (dev/lib)
vbcc_PosixLib.lha (dev/c)
IFF-RGFX.zip (dev/misc)
More...
Newest users
Tinlau
Lullaby20 (Erika)
alfkil (Alfkil Wennermark)
lole (Olle)
jeanluc72

Pending:
ZebraZeem, Mad_Dog, hhjoker, voxel, JosDuchIt, MarcB, MarBo, Sollaris, sara, species
More...
Who's Online
Online members:

abalaban 26 min(s) ago
tboeckel 34 min(s) ago

26 guests are online.

You are an Anonymous user. You can register for free by clicking here.
News sites
Amiga-News.de
Amiga.org
AmigaDev.net
AmigaNN
Amigans.net
Amigaweb.net
AmigaWorld.net
AROS-Exec
MorphOS-News.de
MorphZone
polarBoing
Tutorials
Installing the latest OS4 SDK in Cubic IDE
Writing Installer scripts for AmiUpdate
Cross Compiling for OS4 or OS3 using MS Visual Studio 2005
Installing an AmigaOS 4 cross compiler
Size does matter: Optimizing with size in mind with GCC
More...
Sources
Install SObjs with Installer
How to make clean picture datatypes
Most of the old ClassACT examples converted to OS4
AmigaAnywhere Tutorial - Part 2 Source window1.c
AmigaAnywhere Tutorial - Part 2 Source window2.c
More...
Documentations
How to write portable code for Amiga (english)
Comment écrire du code portable pour Amiga (français)
Development How to with OS3.9 SDK
The PartyPack Hack
The Amiga PDA Programming Guidelines
More...
DreamHost

Support
UtilityBase

[Valid RSS]

UtilityBase needs your help!

How to write portable code for Amiga (english)
by corto
Link: How to write portable code for Amiga (english) (pdf)

This document explains the specificities of each system or compiler. It gives information to program in a portable way. Write once, compile everywhere !

The main chapters are :
1. Includes : understand and manage these files, helping to obtain an organization for several compilers
2. OS specificities : define usage for conditional compilation, OS4 interfaces, amiga.lib and DoSuperNew management, various topics (tasks, memory, ...)
3. Compiler specificities and how to handle them with SDI_headers, hook management
4. Resources : documentation, SDK, support, ...

Please report bugs or questions.

Rate this item
12345678910


Last poster Message


Posted: 2006-Feb-16 00:04:43
Interesting PDF.

Few notes:

Alignment issues. On PPC ULONGs are automatically aligned to ULONG boundary, i.e.

struct foobar
{
UWORD foo;
ULONG bar;
};

would be 8 bytes on PPC but 6 bytes on 68k. If it must be exactly same on 68k and PPC either use #pragma pack():

#pragma pack(2)
struct foobar
{
UWORD foo;
ULONG bar;
};
#pragma pack()

This is important issue especially when porting larger programs from 68k. If in doubt use #pragma pack(2) everywhere and sort it out later when better knowledge over it... performance loss is minimal anyway.

Another thing is SDI_stdarg.h. I dont think it works on AROS...


Posted: 2006-Feb-16 16:51:58
Oops ! You're right, I forgot the alignment issue ... I will wait for other comments before updating the document.

Thank you for your compliment, itix !

About portability, we may add a part dedicated to SDL ? This well known lib is often used for Amiga projects now.


Posted: 2006-Feb-16 23:09:45
SDL always same was it OS3, OS4, MOS or AROS... do you have something specific in mind?


Posted: 2006-Feb-17 14:24:04
I have nothing specific in mind ... there could have differences in compilation commands and mainly in features (joystick support, OpenGL, ...). But it's not really the goal of this document. What you wrote about alignment issues is far more important.

For those who could be interested in my portable Amiga developments, I recently opened my blog :)


Posted: 2006-Feb-17 17:31:27
Joystick internals are hidden behind SDL API and depending on SDL implementation it either works or not... In MOS it is based on lowlevel.library and on OS4 on amigainput.library but to SDL program it doesnt make difference. In practise all issues with SDL are porting issues from other OS'es and that is whole new matter...

Btw there is no libamiga.a in MorphOS SDK but it is libabox.a and libaboxstubs.a. In VBCC it is libamiga.a still. Anyway it doesnt matter because they are automatically linked in and it is not necessary include them on the linking stage.


Posted: 2008-Nov-17 14:36:53
@itix

I found out this alignment thing the hard way when attempting to recreate a 68k system library for OS4 PPC and it just kept crashing at these strange offsets. Very annoying!


Posted: 2009-Jun-29 04:58:36
it is not necessary include them on the linking stage.
[color=#D7D7D7]sonnerie portable gratuite[/color]


Posted: 2009-Jun-29 16:34:01
@manola

And what's this ringtone crap got to do with alignments?


Posted: 2009-Jun-29 17:47:39
@hypex: do you really expect an answer?


Posted: 2009-Jun-30 15:46:39
@wawa

No, just like to voice an opinion.

Hey you answered, thanks! That makes it all worth while! :-D

The profile looked more together than most. Should we spam the guy? ;-)

:: Your comment
Bold Style  Italic Style  Underlined Style  Image Link  Insert URL  Email Link  Quote  C/C++ Source  Disable *What`s that?


Before posting non-english message, check your browser`s encoding!
» Name » Password

UtilityBase is a site focused on development for Amiga systems,
spanning over all different Amiga clones, that be AmigaOS 3.x, 4.x, MorphOS, AROS or AmigaDE/Anywhere.
News syndication: RSS
Contact address: mail@utilitybase com