Re: [Rd] Problems in building a DLL in 64-bit Windows

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon, 12 Dec 2011 13:37:28 +0000 (GMT)

What is R.ddl? Or is that not the actual output?

In any case, it isn't going to work unless you run 64-bit 'R', and my guess is that you used 32-bit 'R' to do this. Make sure you use

..../bin/x64/R CMD

and you do not need the -L....

On Mon, 12 Dec 2011, 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:

which 'FAQ page' (which FAQ, which page ...)?

> C:/PROGRA~1/R/R-214~1.0/bin/x64/R.ddl: 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
>

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 12 Dec 2011 - 13:41:53 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 12 Dec 2011 - 20:50:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive