64-bit D and interfacing with C

David Friedman dvdfrdmn at users.ess-eff.net
Sun Feb 18 06:28:24 PST 2007


Many of the Phobos modules that interface C currently use 'int' and 
'uint' when the actual C declaration is 'long' or 'unsigned long'.  This 
works 32-bit sytems, but not for most 64-bit sytems.

Should there be a standard definition for the C long and unsigned long 
types? My current solution is to add 'Clong_t' and 'Culong_t' to the 
std.stdint module:

     version(GNU)
     {
	import gcc.builtins;
	alias __builtin_Clong Clong_t;
	alias __builtin_Culong Culong_t;
     }
     else /* For DMD: */ version(X86_64)
     {
	// Needs more conditionals for LP64 vs. LLP64...
	alias long Clong_t;
	alias ulong Culong_t;
     }
     else
     {
	alias int Clong_t;
	alias uint Culong_t;
     }



More information about the Digitalmars-d mailing list