2011/10/29 Thomas Chust <ch...@web.de>: > 2011/10/29 Norman Gray <nor...@astro.gla.ac.uk>: >> [...] >> Is there a recommended way to detect whether racket is a 32- or >> 64-bit executable? >> [...] > > Hello Norman, > > while I don't know whether this strategy is particularly > recommendable, I would suggest to use utilities from the FFI module: > > (require (only-in ffi/unsafe compiler-sizeof)) > > (compiler-sizeof 'long) ; => 8 on a 64-bit system > ; => 4 on a 32-bit system >
That doesn't work in all cases, sizeof(long) is 4 on 64-bit Windows. Niklas >> [...] >> I'm writing a racket extension to wrap a C library >> <http://purl.org/nxg/dist/racket-librdf>, and in the configure.ac, I >> want to be able to detect whether racket is a 32- or 64-bit >> executable, so I know whether to (adjust CFLAGS to) check for a >> suitably-compiled version of the library being wrapped -- a 32-bit >> racket needs a 32-bit underlying library, and so on. >> [...] > > While it is true that all the linked objects must be compiled for the > same architecture, this kind of check is automatically performed by > any decent linker without the need for special flags and failure to > find matching libraries will result in a linker error. > > You may have to specify flags to the C compiler, though, if the > default target architecture of the compiler doesn't match the > architecture for which Racket and the libraries to be wrapped were > compiled. > > Ciao, > Thomas > > > -- > When C++ is your hammer, every problem looks like your thumb. > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users