Success:

@@ -188,6 +188,8 @@
     r_exec = os.path.join(r_home, 'bin', 'R')
     # Twist if Win32
     if sys.platform == "win32":
+        if sys.version.find("64 bit") > 0:
+            r_exec = os.path.join(r_home, 'bin', 'x64', 'R')
         if sys.version_info >= (3,):
             import subprocess
             p = subprocess.Popen('"'+r_exec+'" --version',
@@ -332,14 +334,19 @@


 def get_rconfig(r_home, about, allow_empty = False):
-    r_exec = os.path.join(r_home, 'bin', 'R')
+    if sys.platform == "win32" and sys.version.find("64 bit") > 0:
+        r_exec = os.path.join(r_home, 'bin', 'x64', 'R')
+    else:
+        r_exec = os.path.join(r_home, 'bin', 'R')
     cmd = '"'+r_exec+'" CMD config '+about
+    print cmd
     rp = os.popen(cmd)
     rconfig = rp.readline()
     #Twist if 'R RHOME' spits out a warning
     if rconfig.startswith("WARNING"):
         rconfig = rp.readline()
     rconfig = rconfig.strip()
+    print rconfig
     rc = RConfig.from_string(rconfig, allow_empty = allow_empty)
     rp.close()
     return rc
@@ -348,6 +355,7 @@
     #r_libs = [os.path.join(RHOME, 'lib'), os.path.join(RHOME, 'modules')]
     r_libs = []
     extra_link_args = []
+    extra_compile_args = []

     #FIXME: crude way (will break in many cases)
     #check how to get how to have a configure step
@@ -355,6 +363,12 @@

     if sys.platform == 'win32':
         define_macros.append(('Win32', 1))
+        if sys.version.find('64 bit') > 0:
+            define_macros.append(('Win64', 1))
+            extra_link_args.append('-m64')
+            extra_compile_args.append('-m64')
+            # See http://bugs.python.org/issue4709
+            define_macros.append(('MS_WIN64', 1))
     else:
         define_macros.append(('R_INTERFACE_PTRS', 1))
         define_macros.append(('HAVE_POSIX_SIGJMP', 1))
@@ -368,7 +382,6 @@
     else:
         pass

-
     include_dirs = []

     rinterface_ext = Extension(
@@ -403,8 +416,9 @@
             library_dirs = r_libs,
             define_macros = define_macros,
             runtime_library_dirs = r_libs,
+            extra_compile_args=extra_compile_args,
             #extra_compile_args=['-O0', '-g'],
-            #extra_link_args = extra_link_args
+            extra_link_args = extra_link_args
             )

     rpy_device_ext = Extension(
@@ -419,6 +433,7 @@
         library_dirs = r_libs,
         define_macros = define_macros,
         runtime_library_dirs = r_libs,
+        extra_compile_args=extra_compile_args,
         #extra_compile_args=['-O0', '-g'],
         extra_link_args = extra_link_args
         )

It turned out to be (mostly) a matter of defining the right
preprocessor symbols. I've run through some of the examples in the
documentation with no obvious ill effects.

Johan

On Wed, Jan 2, 2013 at 12:18 AM, Johan Johansson <johan2s...@gmail.com> wrote:
> On Wed, Jan 2, 2013 at 12:07 AM, Laurent Gautier <lgaut...@gmail.com> wrote:
>> On 2013-01-01 23:45, Johan Johansson wrote:
>
>>> #if SIZEOF_SIZE_T != SIZEOF_INT
>>> /* On a 64-bit system, rename the Py_InitModule4 so that 2.4
>>>     modules cannot get loaded into a 2.5 interpreter */
>>> #define Py_InitModule4 Py_InitModule4_64
>>> #endif
>
>> The comment suggests that this concerns pre-Python2.4 vs post-Python2.5
>> compiled module.
>> May be not a big issue for now.
>
> What worries me is that SIZEOF_SIZE_T shouldn't equal SIZEOF_INT on a
> 64-bit system but apparently does. This makes me suspect I'm missing
> compiler flags/defines somewhere.
>
> Johan

------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to