COM Integration

Revision as of 18:58, 5 December 2012 by Lchrisman (talk | contribs) (Created page with "''This page describes a proposed feature that does not yet exist in Analytica or ADE (as of release 4.4). We make it available to encourage you and other users to review it and ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page describes a proposed feature that does not yet exist in Analytica or ADE (as of release 4.4). We make it available to encourage you and other users to review it and to make comments before we implement the feature(s).

Requires Analytica Enterprise, Optimizer or ADE.

The Microsoft Component Object Model (COM) provides a framework for interprocess communication within the Windows operating system. The features described here allow your model to call other applications that expose a COM automation interface (known as the IDispatch interface). You can write your own COM servers in C++, C#, VB, and a host of other languages, and then call them, or you can use existing interfaces to call applications from other vendors.

The features here allow your Analytica model to call other applications. This is different from having other applications call your Analytica model. The latter is what ADE provides.

CreateCOMObject(name,server,inProcess,outOfProcess,force64bit,force32bit,flags)

The first step when using COM is to instantiate a COM object, which is done using the function 'CreateCOMObject (note: You can also obtain an Excel::_Workbook object using SpreadsheetOpen, which can be used as a COM object). Only the first parameter is required, and it is rare that you would need to worry about the remaining parameters.

Parameters:

  • «name» : The textual name of the COM class being instantiated. This can be a name such as "WScript.Shell" or "ADE4.CAEngine", or it can be a clsid such as "clsid:72C24DD5-D70A-438B-8A42-98424B88AFB8".
  • «server»: (optional text) The name of the computer where the object will run. Allows remote invocation, or can be "localhost".
  • «inProcess»: (optional boolean) Specifies whether in-process invocation is allowed.
  • «outOfProcess»: (optional boolean) Specifies whether out-process invocation is allowed.
  • «force64bit»: (optional boolean) Specifies that the 64-bit version of the server should be used, even if you are running Analytica 32-bit.
  • «force64bit»: (optional boolean) Specifies that the 64-bit version of the server should be used.
  • «flags»: (optional integer bitfield). Additional esoteric flags (see the CLSCTX enumeration in Microsoft documentation).
  • TBD: Parameters for account to run under.

In most cases, the instantiated object runs on the same machine as the Analytica calling process, however, remote invocation is possible, known as DCOM. When the «server» parameter is not specified, the target computer is determined by the DCOMCNFG settings for that component. By running the DCOMCNFG program, or entering "DCOM Config" in the Microsoft Component Services, you can configure specific COM components to run on specific remote servers. The «server» parameter overrides that setting. The COM component will usually need to be installed on both machines.

The programs that implement COM objects can either run in-process or out-of-process and can be 32-bit or 64-bit programs. Some COM servers provide both in-process and out-of-process versions and some provide both 32-bit and 64-bit versions. If you don't specify any of the optional flags («inProcess», «outOfProcess», «force64bit» or «force32bit»), it will allow any possible combination that it finds to run. You can use these flags to force a specific type to run. For example:

CreateComObject("MyObject", outOfProcess:true, force64bit:true )

would force the creation of a MyObject in an out-of-process 64-bit server, whereas without the flags it might have created an in-process 32-bit instance. Some COM servers provide only one type. For example, ABODB classes can only be used in-process.

Not all combinations of flags are valid. Here are some basic constraints:

  • Any remote invocation (on a different machine) is automatically out-of-process.
  • Any in-process invocation must have the same bitness (32-bit or 64-bit) as the Analytica or ADE program you are using. (Out-of-process bitness can differ).
  • 64-bit objects can only be used when you are running Windows 64-bit.
  • When neither «force64bit» nor «force32bit» are specified, it defaults to the same bitness as the calling process when both are available.
Comments


You are not allowed to post comments.