[Rd] Creating a Windows import lib from R.dll (x64)?

Joe Conway
Tue, 19 Oct 2010 05:22:53 -0000

On 10/18/2010 10:00 PM, Dominick Samperi wrote:
>
> The procedure for creating an import library (Rdll.lib) that is documented
> in gnuwin32/README.packages works fine using the i386 architecture, but
> it doesn't seem to work under x64.
>
> Specifically, the procedure is:
> pexports R.dll > R.exp
> lib /def:R.exp /out:Rdll.lib /machine:X86 R.dll
>
> There are two issues under x64:
> 1. Older version of pexports crash when applied to an x64 R.dll.
>     The work-around is to use one of the newer versions that have
>     been fixed (pexports-9.44, say).
> 2. When lib is applied to an x64 R.dll it complains as follows:
> R.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x318
>
> This happens even when the /def:R.exp parameter is left out, for
> example, with lib /out:Rdll.lib R.dll.
>
> Any tips would be much appreciated.

I successfully did the following recently in order to build 64 bit PL/R
on Windows 7:

----------------
dumpbin /exports R.dll > R.dump.csv

Note that I used the csv extension so OpenOffice would import the file
into a spreadsheet conveniently.

Edit R.dump.csv to produce a one column file of symbols called R.def.
Add the following two lines to the top of the file:
 LIBRARY R
 EXPORTS

Then run the following using R.def

 lib /def:R.def /out:R.lib
----------------

HTH,

Joe


--
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL:
<https://stat.ethz.ch/pipermail/r-devel/attachments/20101018/e04a59e7/attachment.bin>