Re: [R] Compiling C-code in Windows

2011-05-31 Thread Smith, Dale
Try

CC=gcc -mno-cygwin

to avoid linking with the Cygwin dlls.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Direct NYC: 212-419-3242
Direct Norcross: 678-375-5315
Mobile: 678-982-6599
Mail: dale.sm...@fiserv.com
www.fiserv.com


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Duncan Murdoch
Sent: Tuesday, May 31, 2011 12:33 PM
To: Mike Marchywka
Cc: r-h...@stat.math.ethz.ch; pmi...@ff.uns.ac.rs
Subject: Re: [R] Compiling C-code in Windows

On 11-05-31 12:24 PM, Mike Marchywka wrote:
>
>
>
>
> 
>> Date: Tue, 31 May 2011 11:37:56 -0400
>> From: murdoch.dun...@gmail.com
>> To: tom.osb...@iinet.net.au
>> CC: r-h...@stat.math.ethz.ch; pmi...@ff.uns.ac.rs
>> Subject: Re: [R] Compiling C-code in Windows
>>
>> On 31/05/2011 7:50 AM, Tom Osborn wrote:
>>> You could use cygwin's cc/gcc, or the Watcom opensource compiler.
>>
>> Neither of those is supported. Use what the R Admin manual suggests,
or
>> you're on your own.
>
> I have had fairly good luck with cygwin or mingw but you may need to
> have a few conditionals etc. Not sure what R suggests but cygwin
should
> work.

The MinGW compilers are the recommended ones.  If you use Cygwin, you'll

need to provide the Cygwin DLLs as well, and those may clash with others

on the user's system, so I wouldn't recommend it.

Duncan Murdoch

>
>>
>> Duncan Murdoch
>>
>>> [Watcom used to be a commercial compiler which ceased and has
>>> become an open project].
>>>
>>> But listen to people who've experienced the options. [Not I].
>>>
>>> Cheers, Tom.
>>> - Original Message -
>>> From: Petar Milin
>>> To: R-HELP
>>> Sent: Tuesday, May 31, 2011 9:43 PM
>>> Subject: [R] Compiling C-code in Windows
>>>
>>>
>>> Hello ALL!
>>> I am an Linux user (Debian testing i386), with very dusty
>>> Win-experience. Nevertheless, my colleagues and I are making some
>>> package in R, and I built C-routines to speed up things.
>>> I followed instruction how to compile C for R (very useful link:
>>>
http://www.stat.lsa.umich.edu/~yizwang/software/maxLinear/noteonR.html,
>>> and links listed there). Everything works like a charm in Linux. I
have
>>> *.so and wrapper function from R is doing a right call.
>>> However, I wanted to make *.dll library for Win-users. Now, I used
my
>>> colleague's computer with Win XP on it, and with the latest R. In
MS-DOS
>>> console, I positioned prompt in 'C;\Program
Files\R\R-2.13.0\bin\i386\',
>>> and then I run: 'R CMD SHLIB C:\trial.c'. However, nothing happened,
no
>>> trial.dll, nothing. Then, I tried with: 'R CMD SHLIB
--output=trial.dll
>>> C:\trial.c', but no luck, again.
>>> Please, can anyone help me with this? Can I use: 'R CMD SHLIB
>>> --output=trial.dll C:\trial.c' under Linux, and expecting working
DLL?
>>>
>>> Best,
>>> PM
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Compiling C-code in Windows

2011-05-31 Thread Duncan Murdoch

On 11-05-31 12:24 PM, Mike Marchywka wrote:







Date: Tue, 31 May 2011 11:37:56 -0400
From: murdoch.dun...@gmail.com
To: tom.osb...@iinet.net.au
CC: r-h...@stat.math.ethz.ch; pmi...@ff.uns.ac.rs
Subject: Re: [R] Compiling C-code in Windows

On 31/05/2011 7:50 AM, Tom Osborn wrote:

You could use cygwin's cc/gcc, or the Watcom opensource compiler.


Neither of those is supported. Use what the R Admin manual suggests, or
you're on your own.


I have had fairly good luck with cygwin or mingw but you may need to
have a few conditionals etc. Not sure what R suggests but cygwin should
work.


The MinGW compilers are the recommended ones.  If you use Cygwin, you'll 
need to provide the Cygwin DLLs as well, and those may clash with others 
on the user's system, so I wouldn't recommend it.


Duncan Murdoch





Duncan Murdoch


[Watcom used to be a commercial compiler which ceased and has
become an open project].

But listen to people who've experienced the options. [Not I].

Cheers, Tom.
- Original Message -
From: Petar Milin
To: R-HELP
Sent: Tuesday, May 31, 2011 9:43 PM
Subject: [R] Compiling C-code in Windows


Hello ALL!
I am an Linux user (Debian testing i386), with very dusty
Win-experience. Nevertheless, my colleagues and I are making some
package in R, and I built C-routines to speed up things.
I followed instruction how to compile C for R (very useful link:
http://www.stat.lsa.umich.edu/~yizwang/software/maxLinear/noteonR.html,
and links listed there). Everything works like a charm in Linux. I have
*.so and wrapper function from R is doing a right call.
However, I wanted to make *.dll library for Win-users. Now, I used my
colleague's computer with Win XP on it, and with the latest R. In MS-DOS
console, I positioned prompt in 'C;\Program Files\R\R-2.13.0\bin\i386\',
and then I run: 'R CMD SHLIB C:\trial.c'. However, nothing happened, no
trial.dll, nothing. Then, I tried with: 'R CMD SHLIB --output=trial.dll
C:\trial.c', but no luck, again.
Please, can anyone help me with this? Can I use: 'R CMD SHLIB
--output=trial.dll C:\trial.c' under Linux, and expecting working DLL?

Best,
PM

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Compiling C-code in Windows

2011-05-31 Thread Mike Marchywka





> Date: Tue, 31 May 2011 11:37:56 -0400
> From: murdoch.dun...@gmail.com
> To: tom.osb...@iinet.net.au
> CC: r-h...@stat.math.ethz.ch; pmi...@ff.uns.ac.rs

>
> On 31/05/2011 7:50 AM, Tom Osborn wrote:
> > You could use cygwin's cc/gcc, or the Watcom opensource compiler.
>
> Neither of those is supported. Use what the R Admin manual suggests, or
> you're on your own.

I have had fairly good luck with cygwin or mingw but you may need to
have a few conditionals etc. Not sure what R suggests but cygwin should
work.


>
> Duncan Murdoch
>
> > [Watcom used to be a commercial compiler which ceased and has
> > become an open project].
> >
> > But listen to people who've experienced the options. [Not I].
> >
> > Cheers, Tom.
> > - Original Message -
> > From: Petar Milin
> > To: R-HELP
> > Sent: Tuesday, May 31, 2011 9:43 PM

> >
> >
> > Hello ALL!
> > I am an Linux user (Debian testing i386), with very dusty
> > Win-experience. Nevertheless, my colleagues and I are making some
> > package in R, and I built C-routines to speed up things.
> > I followed instruction how to compile C for R (very useful link:
> > http://www.stat.lsa.umich.edu/~yizwang/software/maxLinear/noteonR.html,
> > and links listed there). Everything works like a charm in Linux. I have
> > *.so and wrapper function from R is doing a right call.
> > However, I wanted to make *.dll library for Win-users. Now, I used my
> > colleague's computer with Win XP on it, and with the latest R. In MS-DOS
> > console, I positioned prompt in 'C;\Program Files\R\R-2.13.0\bin\i386\',
> > and then I run: 'R CMD SHLIB C:\trial.c'. However, nothing happened, no
> > trial.dll, nothing. Then, I tried with: 'R CMD SHLIB --output=trial.dll
> > C:\trial.c', but no luck, again.
> > Please, can anyone help me with this? Can I use: 'R CMD SHLIB
> > --output=trial.dll C:\trial.c' under Linux, and expecting working DLL?
> >
> > Best,
> > PM
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Compiling C-code in Windows

2011-05-31 Thread Duncan Murdoch

On 31/05/2011 7:50 AM, Tom Osborn wrote:

You could use cygwin's cc/gcc, or the Watcom opensource compiler.


Neither of those is supported.  Use what the R Admin manual suggests, or 
you're on your own.


Duncan Murdoch


[Watcom used to be a commercial compiler which ceased and has
become an open project].

But listen to people who've experienced the options. [Not I].

Cheers, Tom.
   - Original Message -
   From: Petar Milin
   To: R-HELP
   Sent: Tuesday, May 31, 2011 9:43 PM
   Subject: [R] Compiling C-code in Windows


   Hello ALL!
   I am an Linux user (Debian testing i386), with very dusty
   Win-experience. Nevertheless, my colleagues and I are making some
   package in R, and I built C-routines to speed up things.
   I followed instruction how to compile C for R (very useful link:
   http://www.stat.lsa.umich.edu/~yizwang/software/maxLinear/noteonR.html,
   and links listed there). Everything works like a charm in Linux. I have
   *.so and wrapper function from R is doing a right call.
   However, I wanted to make *.dll library for Win-users. Now, I used my
   colleague's computer with Win XP on it, and with the latest R. In MS-DOS
   console, I positioned prompt in 'C;\Program Files\R\R-2.13.0\bin\i386\',
   and then I run: 'R CMD SHLIB C:\trial.c'. However, nothing happened, no
   trial.dll, nothing. Then, I tried with: 'R CMD SHLIB --output=trial.dll
   C:\trial.c', but no luck, again.
   Please, can anyone help me with this? Can I use: 'R CMD SHLIB
   --output=trial.dll C:\trial.c' under Linux, and expecting working DLL?

   Best,
   PM

   __
   R-help@r-project.org mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Compiling C-code in Windows

2011-05-31 Thread Tom Osborn
You could use cygwin's cc/gcc, or the Watcom opensource compiler.

[Watcom used to be a commercial compiler which ceased and has
become an open project].

But listen to people who've experienced the options. [Not I].

Cheers, Tom.
  - Original Message - 
  From: Petar Milin
  To: R-HELP
  Sent: Tuesday, May 31, 2011 9:43 PM
  Subject: [R] Compiling C-code in Windows


  Hello ALL!
  I am an Linux user (Debian testing i386), with very dusty
  Win-experience. Nevertheless, my colleagues and I are making some
  package in R, and I built C-routines to speed up things.
  I followed instruction how to compile C for R (very useful link:
  http://www.stat.lsa.umich.edu/~yizwang/software/maxLinear/noteonR.html,
  and links listed there). Everything works like a charm in Linux. I have
  *.so and wrapper function from R is doing a right call.
  However, I wanted to make *.dll library for Win-users. Now, I used my
  colleague's computer with Win XP on it, and with the latest R. In MS-DOS
  console, I positioned prompt in 'C;\Program Files\R\R-2.13.0\bin\i386\',
  and then I run: 'R CMD SHLIB C:\trial.c'. However, nothing happened, no
  trial.dll, nothing. Then, I tried with: 'R CMD SHLIB --output=trial.dll
  C:\trial.c', but no luck, again.
  Please, can anyone help me with this? Can I use: 'R CMD SHLIB
  --output=trial.dll C:\trial.c' under Linux, and expecting working DLL?

  Best,
  PM

  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code. 

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Compiling C-code in Windows

2011-05-31 Thread Andreas Borg

Hi Petar,

did you install the toolset (Rtools) for compiling code for R in 
windows? See


http://cran.r-project.org/doc/manuals/R-admin.html#The-Windows-toolset

and

http://www.murdoch-sutherland.com/Rtools/

Please, can anyone help me with this? Can I use: 'R CMD SHLIB 
--output=trial.dll C:\trial.c' under Linux, and expecting working DLL?


Of course not, because Windows and Linux libraries differ by more than 
the filename extension.


Once everything is set up, compiling in windows is pretty easy thanks to 
the toolset.


Good luck,

Andreas

--
Andreas Borg
Medizinische Informatik

UNIVERSITÄTSMEDIZIN
der Johannes Gutenberg-Universität
Institut für Medizinische Biometrie, Epidemiologie und Informatik
Obere Zahlbacher Straße 69, 55131 Mainz
www.imbei.uni-mainz.de

Telefon +49 (0) 6131 175062
E-Mail: b...@imbei.uni-mainz.de

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. 
Wenn Sie nicht der
richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren 
Sie bitte sofort den
Absender und löschen Sie diese Mail. Das unerlaubte Kopieren sowie die 
unbefugte Weitergabe
dieser Mail und der darin enthaltenen Informationen ist nicht gestattet.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Compiling C-code in Windows

2011-05-31 Thread Duncan Murdoch

On 31/05/2011 7:43 AM, Petar Milin wrote:

Hello ALL!
I am an Linux user (Debian testing i386), with very dusty
Win-experience. Nevertheless, my colleagues and I are making some
package in R, and I built C-routines to speed up things.
I followed instruction how to compile C for R (very useful link:
http://www.stat.lsa.umich.edu/~yizwang/software/maxLinear/noteonR.html,


You should follow the instructions in the R Installation and 
Administration manual to set up the tools on your Windows system.




and links listed there). Everything works like a charm in Linux. I have
*.so and wrapper function from R is doing a right call.
However, I wanted to make *.dll library for Win-users. Now, I used my
colleague's computer with Win XP on it, and with the latest R. In MS-DOS
console, I positioned prompt in 'C;\Program Files\R\R-2.13.0\bin\i386\',
and then I run: 'R CMD SHLIB C:\trial.c'. However, nothing happened, no
trial.dll, nothing.



Really nothing?  Not even an error message?


Then, I tried with: 'R CMD SHLIB --output=trial.dll

C:\trial.c', but no luck, again.
Please, can anyone help me with this? Can I use: 'R CMD SHLIB
--output=trial.dll C:\trial.c' under Linux, and expecting working DLL?


I assume you mean "under Windows".  I would normally use a forward 
slash, i.e. C:/trial.c; I don't remember if the R CMD code handles 
backslashes.  (It might treat \t as a tab.)  With that change, this 
should work.


One piece of unsolicited advice:  I would hardly ever use R CMD SHLIB. 
Just include the C code in a package, and this is handled automatically 
by R CMD INSTALL.  You won't need the .First.lib if you have a 
useDynLib() statement in your NAMESPACE.


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.