Re: Porting an app on an 64bits arch
On Fri, Apr 22, 2005 at 02:23:41PM +0200, Guillaume R. wrote:
> I'm really new to the 64bits arch and wish to know how I could port some
> apps under such an arch.
> Is there a guide or something like that explain how to achieve such a goal?
Well step 1:
Try and compile the program as is. It might work if it is very well
If it doesn't work or doesn't compile, it's time to go find anywhere
that abuses int to store pointers. int is 32bit and poitners are 64bit
on a 64bit system in general. Generic pointer storage should either be
done as type* or void*, not int or long being abused to store the
You also have to make sure everything uses the same type everywhere. I
recently found a bug in bb where a buffer was malloc'd with x *
sizeof(int) and used that way except when clearing the buffer it had
memset(x * sizeof(long)) which of course wiped twice what it should
(since long is 64bit on amd64, but 32bit like int on x86).
Any other assumptions about type sizes need to be fixed (assuming
anything about type sizes other than their minimum size as per C
standard is bad code and should be fixed after all). If you want a
32bit type, you better find one at compile time and use a define to put
it everywhere needed. Or use the C standard types for such things
(int8_t and such or whatever they are called).