The RDCOMServer Package (version 0.3-2)

This package provides a mechanism to export S objects (values, functions, collections of S functions, etc.) as (D)COM objects in Windows. One can define COM objects with methods and properties entirely within S and make them accessible to clients written in other languages and available to other processes. Clients can treat these as regular COM objects and need not be aware that they are written in S. One can also define event handlers entirely within S and connect them to DCOM event sources such as Excel or Active X controls.

This package can be used along with the RDCOMClient package which provides user-level access from S to other COM servers. The ability to export S objects as COM values is important for general bi-directional connectivity with other COM clients.

The management of class in the Windows registry uses the general SWinRegistry package. And the UUIDs used to uniquely identify classes, etc. are generated using Robert Gentleman's Ruuid package.

This RDCOMServer package is different from the other RCOM package from Thomas Baier which explicitly makes the R evaluator available. The model in this package allows S programmers to define new COM classes in S and make arbitrary S functionality and data available in different forms to non-S programmers. Users of the objects do not have to know anything about the S language and its syntax. Instead, they use the objects as if they were local to their language and simply invoke methods and access properties in the usual way for that language. In addition to exporting explicit COM definitions, it also supports returning arbitrary S objects, not limited to the primitive types and arrays of these. Also, the package allows S programmers to define how the objects are published, and provides a flexible and extensible mechanism for implementing the invocation of methods and properties. So in these regards, it is a framework for enabling S programmers to provide COM objects via S to clients in the regular COM manner. It simplifies the programming of COM clients using R and, together with the RDCOMClient package, provides greater choice in which language(s) one programs the computations. (See Paradigm.html for more details.)

This RDCOMServer package provides an example server which exports methods to access the R interpreter in much the same way that Thomas' RCOM does. This is just a special case and serves as an example. The server does not provide the important graphics device or R console however.

This package is also quite different from S-Plus's COM export facility. One can export collections of functions as regular COM methods and invoke them from clients atomically. This is different from having to set the arguments one at a time in the object, invoke the Run method, and then retrieve the result.

This RDCOMServer package provides a highly extensible mechanism for controlling the dispatch of methods and properties. It is easy to create new dispatch mechanisms that find and invoke methods and properties in different ways.

Download

To use this package you will need to also install the following packages:

The SWinTypeLibs package can be useful for creating S COM classes for event handling, computing a local map for enumerated constants, or merely reading existing COM interface description into S.

You can get binaries for these and install them simply by unzipping them from within in the $R_HOME/library directory.

Documentation

  • User Guide
    An early draft.
  • Paradigm
    A discussion of the different approaches to adding (D)COM support for R and why the full object model is necessary. This explains the motivation for a fully general model.
  • Annotated examples
    An annotated collection of related server and client examples.
  • Handling COM Events in R
    A description of how to use S functions to implement COM event handlers, e.g. for Active X, Excel, etc.
  • FAQ
    Frequently asked questions.
  • Examples

    There are examples in the examples/ directory illustrating how to define and register COM classes from S. In that directory and also the tests/ directory, there are examples of how to use these from different higher-level languages inluding Java, Python, Perl and Visual Basic).
    Duncan Temple Lang <duncan@research.bell-labs.com>
    Last modified: 2003/12/05/22/03