[Ecls-list] Help needed, really

DS ecl at sol42.com
Sat Jan 1 20:23:40 UTC 2011


 
On 1 Jan 2011, at 20:13, Gabriel Dos Reis wrote:

> Anyway, I do no believe that the suggestion for ECL to make available

> its binary flavor is equivalent to building and maintaining a database

> of all imaginable ABIs and all combinations of processors.



I believe Juanjo was referring to the second obvious way to figure out 
system info from C: conditional compilation.  In that case the C code 
would be sort of like



#if defined(linux)

...

#else if defined(FreeBSD)

...

#else if defined(__HAIKU__)

...

#else

...

#endif



and you have to know the exact symbol used by every supported platform: 
some are lowercase, some are uppercase and have underscores, etc.  Same 
for system version and architecture.  This would be the database Juanjo 
does not want to build and maintain, and I find that understandable.



BTW this is the only way to tell one C compiler from another from 
'inside' C that I know of.



The first obvious way (for me at least) would be the uname() libc call, 
but it is more limited and as far as I know is not present on some 
platforms, so it would require an autoconf test.



Figuring out the ILP32/LP64/whatever bit is a matter of comparing 
sizeof()'s.  It is also easy to figure out endianness.  This is very 
simple and portable C code.



OTOH configure scripts usually do some or all of these tests.  GMP is 
extremely platform-dependant and surely knows about all this.  
Extracting the information from there might be easier and more portable.



Regards.

-DS







More information about the ecl-devel mailing list