[R] dlls

Duncan Murdoch dmurdoch at pair.com
Fri Apr 30 14:45:15 CEST 2004

On Fri, 30 Apr 2004 10:33:22 +0100 (BST), Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote :

>On Fri, 30 Apr 2004, Ben.Flood wrote:
>> 	I am trying to run an algorithm in a large dataset and want to speed
>> this process up by using C/C++ functions.  I have been attempting to create
>> a dll library using Microsoft Visual C++ in Windows and call that using
>> dyn.load("file.dll") but when I use is.loaded("function") I invariably get
>> FALSE.  
>> 	If anybody has done this and could give me more detailed
>> instructions it would be very much appreciated,
>It's a `Microsoft Visual C++ in Windows' issue, not an R issue.  I expect
>you are not exporting any entry points (the default under that `system',
>amazingly): readme.packages tells you how to use VC++ in detail, and there
>are worked examples in the on-line complements to `S Programming'.
>Do you have a very good reason to make things difficult for yourself by 
>not using the recommended compilers?  Just a thought ....

I think there are good reasons to support VC++, but not good enough
that I actually want to do it :-).  The two main reasons are:

 - it produces faster code than gcc
 - the debugger is much nicer than gdb

I think the choice not to export entry points is a good choice:
programmers should think about what parts of the interface to their
modules are visible to users.  It may feel unnatural in C, but it
really is a good idea.

If anyone who does use VC++ finds that any of the details in
readme.packages are out of date, please send me corrections.

Duncan Murdoch

More information about the R-help mailing list