[R] R (2.2.0), R-DCOM and Delphi

Earl F. Glynn efg at stowers-institute.org
Mon Nov 7 18:19:54 CET 2005


"Dieter Menne" <dieter.menne at menne-biomed.de> wrote in message
news:<loom.20051107T143033-989 at post.gmane.org>...
> Jose Claudio Faria <joseclaudio.faria <at> terra.com.br> writes:

> Looks like a missing file in "uses". I compiled it under Delphi 5, and it
looks
> like the variants are no longer included in my "uses".
>
> Try to find out via help file where VarType is declared, add it to "uses".
And
> please tell me about the result when you got it compiled, I will add your
> finding to the archive.

Here's what worked for me:

(1) Install the new (D)COM server (the old one gives the error "Method '~'
of object '~' failed" with R 2.2.0):

     For anybody who wants to try the R(D)COM server alone, I recommend
     http://sunsite.univie.ac.at/rcom/download/RSrv200beta.exe
     It is reasonably stable and will work with R 2.2.0.


(2) In C:\Program Files\R\(D)COM Server\samples\Simple run the simple.exe to
verify the server is working.


(3) Download and unzip:  http://www.menne-biomed.de/download/RDComDelphi.zip

Like Jose Claudio Faria described, a number of warnings and errors will be
seen in Delphi 7 in compiling the unmodified RDCom.dpr project.

To fix the compilation errors, add the "Variants" unit to the uses:

uses
  Windows, Messages, SysUtils,Classes, Dialogs,
STATCONNECTORSRVLib_TLB,Forms, Variants;

I don't remember why Borland made this change.

You can make the Warnings go away by selecting Project | Options | Compiler
Messages and unchecking the boxes for

- Unsafe type
- Unsafe code

These warning were introduced with Borland made changes to support .NET.
The code should be quite fine for Win32.

Note:  The Delphi source code could be modified to use {$IFDEF} directives
to take care of the differences by compiler version.  See the "Compiler
Versions" section of this page:
http://www.efg2.com/Lab/Library/Delphi/Miscellany/index.html.
Unfortunately, Borland has not been very helpful in promoting the use of a
common "Versions.INC" file or any other mechanism to take care of such
compiler version problems in a uniform way.  The file "Versions.INC" must be
updated with every new release by Borland.


(4) Run the RDCom.exe program. Select the "Run" and "Plot" buttons and see a
wonderful demo of Delphi and R working together.  (Now I can get busy and
use this in other Delphi applications with R as a "backend".)


Thanks for the work on R-DCOM and this great example!

efg
Scientific Programmer
Stowers Institute for Medical Research




More information about the R-help mailing list