From ligges at statistik.tu-dortmund.de  Mon Dec 12 20:37:12 2011
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Mon, 12 Dec 2011 20:37:12 +0100
Subject: [Rd] Problems in building a DLL in 64-bit Windows
In-Reply-To: <20111212131228.732736q174vpaxmk@mail.sapo.pt>
References: <20111212131228.732736q174vpaxmk@mail.sapo.pt>
Message-ID: <4EE657E8.20406@statistik.tu-dortmund.de>



On 12.12.2011 14:12, ruipbarradas at sapo.pt wrote:
>
> I am trying to build a C language DLL and it works well with i386 but when I compile with it substituted
> by x64, like the FAQ page says, the result is an error message:
>
> C:/PROGRA~1/R/R-214~1.0/bin/x64/R.ddl:

What is R.ddl? Do you mean R.dll?

If this is a typo: Is your OS 64 bit? Have you used the right compiler 
collection for making 64-bit code according to the manual?

Best,
Uwe Ligges



file not recognized : File format not recognized
> collect2: ld returned 1 exit status
>
> How can I solve this? The problem is with R 2-14.0 and 2-13.0
>
> The complete source code is
>
> /*
> * myfun.c
> */
> #include<stdio.h>
> #include<R.h>
> #include<Rinternals.h>
> #include<R_ext/Rdynload.h>
>
> void myfn(double *x){ *x += 1; }
>
> The DLL is build like this:
>
> R CMD SHLIB -LC:/PROGRA~1/R/R-214~1.0/bin/x64 -lR myfun.c -o myfun64.dll
>
> and get the error message above.
>
> The R code:
>
> #
> # myfun.R: this works with i386, but not with x64
> #
> dyn.load("myfun64.dll")
> f<- function(x) {.C("myfn", x=as.double(x))$x}
> f(1)
> f(1000)
> dyn.unload("dllmain.dll")
>
> I am trying to build a package, or at least a set of functions, and performance is sometimes a problem.
> Thank you,
>
> Rui Barradas
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Problems in building a DLL in 64-bit Windows
Uwe Ligges