1 /* ----------------------------------------------------------------------------- 2 * swigarch.i 3 * 4 * SWIG library file for 32bit/64bit code specialization and checking. 5 * 6 * Use only in extreme cases, when no arch. independent code can be 7 * generated 8 * 9 * To activate architecture specific code, use 10 * 11 * swig -DSWIGWORDSIZE32 12 * 13 * or 14 * 15 * swig -DSWIGWORDSIZE64 16 * 17 * Note that extra checking code will be added to the wrapped code, 18 * which will prevent the compilation in a different architecture. 19 * 20 * If you don't specify the SWIGWORDSIZE (the default case), swig will 21 * generate architecture independent and/or 32bits code, with no extra 22 * checking code added. 23 * ----------------------------------------------------------------------------- */ 24 25 #if !defined(SWIGWORDSIZE32) && !defined(SWIGWORDSIZE64) 26 # if (__WORDSIZE == 32) 27 # define SWIGWORDSIZE32 28 # endif 29 #endif 30 31 #if !defined(SWIGWORDSIZE64) && !defined(SWIGWORDSIZE32) 32 # if defined(__x86_64) || defined(__x86_64__) || (__WORDSIZE == 64) 33 # define SWIGWORDSIZE64 34 # endif 35 #endif 36 37 38 #ifdef SWIGWORDSIZE32 39 %{ 40 #define SWIGWORDSIZE32 41 #ifndef LONG_MAX 42 #include <limits.h> 43 #endif 44 #if (__WORDSIZE == 64) || (LONG_MAX != INT_MAX) 45 # error "SWIG wrapped code invalid in 64 bit architecture, regenarete code using -DSWIGWORDSIZE64" 46 #endif 47 %} 48 #endif 49 50 #ifdef SWIGWORDSIZE64 51 %{ 52 #define SWIGWORDSIZE64 53 #ifndef LONG_MAX 54 #include <limits.h> 55 #endif 56 #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX) 57 # error "SWIG wrapped code invalid in 32 bit architecture, regenarete code using -DSWIGWORDSIZE32" 58 #endif 59 %} 60 #endif 61 62 63