cinit: Initialize R <-> .NET bridge

Description Usage Arguments Details Examples

Description

The function either connects to an existing running CLR bridge process at the given host:port or instantiates a new CLR server on the local computer with the given port and server arguments.

Usage

1
.cinit(host='localhost', port=56789, dll=NULL, server.args=NULL)

Arguments

host

The host machine on which the CLR bridge server is running; generally this is the localhost, which is the default.

port

The port on which the CLR bridge is listening (default: 56789)

dll

The path to an optional library dll to be loaded by the server. This dll would contain .NET classes and functions one wants to call from R.

server.args

Optional parameters to the CLRServer process (CLRServer.exe -help to list the options).

Details

If the .NET libraries are to be changed, the CLRServer process and R should be restarted. CLR references in the R session are only valid for the current CLR server instance.

Instead of calling .cinit(dll="~/mydll.dll") explictly one can set an environment variable Sys.setenv(rDotNet_DLL="~/mydll.dll") and use .cnew() and other functions after loading the package as opposed to first calling .cinit. One can also run the CLRServer from the command line or an IDE with the appropriate DLL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 

## create .NET bridge server, loading personal library to be referenced in the R session
.cinit (dll="~/Dev/MyLibrary.dll")
obj <- .cnew("NormalDistribution1D", 0.0, 1.0)

## alternative without explicit initialization
Sys.setenv(rDotNet_DLL="~/Dev/models.dll")
...
obj <- .cnew("NormalDistribution1D", 0.0, 1.0)


## End(Not run)

rDotNet documentation built on May 2, 2019, 8:19 a.m.