
I am learning how to load C code into R-1.8.0 on Windows 98. To this end I wrote
a small c program, downloaded the tools, perl, and mingw on the "building
R for windows" page, and proceeded to create libR.a & libRblas.a as explained
in the readme.packages. I started with a simple c program called mysum.c that can
be found on:

http://www.okada.jp.org/RWiki/?R%A4%AB%A4%E9%C2%BE%B8%C0%B8%EC%CD%F8%CD%D1

If the c program is called mysum.c, I type, after cd'ing into
R_home\bin on the MS-DOS shell:

> rcmd shlib [-o mysum.dll] mysum.c

and the output reads:

>MkRules:93: warning: overriding commands for target `.c.d'
>C:/R/RW1080/src/gnuwin32/MkRules:93: warning: ignoring old commands for target `
>.c.d'
>MkRules:97: warning: overriding commands for target `.cc.d'
>C:/R/RW1080/src/gnuwin32/MkRules:97: warning: ignoring old commands for target `
>.cc.d'
>MkRules:101: warning: overriding commands for target `.cpp.d'
>C:/R/RW1080/src/gnuwin32/MkRules:101: warning: ignoring old commands for target
>`.cpp.d'
>MkRules:105: warning: overriding commands for target `.C.d'
>C:/R/RW1080/src/gnuwin32/MkRules:105: warning: ignoring old commands for target
>`.C.d'
>MkRules:109: warning: overriding commands for target `.c.o'
>C:/R/RW1080/src/gnuwin32/MkRules:109: warning: ignoring old commands for target
>`.c.o'
>MkRules:112: warning: overriding commands for target `.f.o'
>C:/R/RW1080/src/gnuwin32/MkRules:112: warning: ignoring old commands for target
>`.f.o'
>MkRules:115: warning: overriding commands for target `.cc.o'
>C:/R/RW1080/src/gnuwin32/MkRules:115: warning: ignoring old commands for target
>`.cc.o'
>MkRules:118: warning: overriding commands for target `.cpp.o'
>C:/R/RW1080/src/gnuwin32/MkRules:118: warning: ignoring old commands for target
>`.cpp.o'
>MkRules:121: warning: overriding commands for target `.C.o'
>C:/R/RW1080/src/gnuwin32/MkRules:121: warning: ignoring old commands for target
>`.C.o'

But nevertheless creates the dll file mysum.dll. 

I go to Rgui. At the prompt I type: 

> dyn.load("R_home\\bin\\mysum.dll") # and I tried 'dyn.load("R_home\\bin\\mysum")' 

which gives the response:

Error in dyn.load(x, as.logical(local), as.logical(now)) : 
        unable to load shared library "C:/R/rw1080/bin/mysum.dll":
  LoadLibrary failure:  The operation completed successfully.

and of course,

> is.loaded("mysum") # or is.loaded("mysum.dll") 
[1] FALSE

Below is how I set up the path in the autoexec.bat:

PATH = c:\cygwin; C:\MinGW\mingw32\bin; C:\Perl\bin\; C:\WINDOWS;  C:\Windows\Command 

cygwin is where the tools are, and perl, minGW are from the "building R from windows" page. I tried
this with the same path as above, except with "C:\MinGW\mingw32\bin" replaced with
"C:\MinGW\bin" but only to get the same results.

I am using Dev-C++ Version 4 to compile my C source code. If I need to edit MkRules,
what precisely do I need to change and how should I change it? Do I need a different
compiler (lcc?) ? What examply am I not doing right?

Thanks in advance for your time,

Kenichi Okamoto
 



---------------------------------
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/
	[[alternative HTML version deleted]]


