Installation Issues
It is assumed that the server vendor will provide a
SETUP.EXE to install the needed components for their server. This will
not be discussed further. Other than the actual components, the main issue
affecting OLE software is management of the Windows Registry and Component
Catagories. The issues here are (a) what entries need to be made and (b)
how they can be made.
Again, certain common installation and registry topics
including self registration, automatic proxy/stub registration and registry
reference counting are discussed in the OPC Overview Document
Component Categories
The OPC Data Access Interface
defines the following Component Catagories. Listed below are the CATIDs,
Descriptors and Symbolic Equates to be used for Data Access.
"OPC Data Access Servers Version
1.0"
CATID_OPCDAServer10 = {63D5F430-CFE4-11d1-B2C8-0060083BA1FB}
"OPC Data Access Servers Version
2.0"
CATID_OPCDAServer20 = {63D5F432-CFE4-11d1-B2C8-0060083BA1FB}
It is expected that a server
will first create any category it uses and then will register for that
category. Unregistering a server should cause it to be removed from that
category. See the ICatRegister documentation for additional information.
Registry Entries for Custom
Interface
The following entries are the minimum required to support
the Custom Interface for OPC Compliant Servers.
Required by all:
1. HKEY_CLASSES_ROOT\Vendor.Drivername.Version
= A Description of your server
2. HKEY_CLASSES_ROOT\Vendor.Drivername.Version\CLSID
= {Your Servers unique CLSID}
3. HKEY_CLASSES_ROOT\Vendor.Drivername.Version\OPC
4. HKEY_CLASSES_ROOT\Vendor.Drivername.Version\OPC\Vendor
=Your vendor name
5. HKEY_CLASSES_ROOT\CLSID\{Your Servers unique
CLSID} = A Description of your server
6. HKEY_CLASSES_ROOT\CLSID\{Your Servers unique
CLSID}\ProgID = Vendor.Drivername.Version
One or more of the following lines (inproc and/or local/remote
and/or handler)
7. HKEY_CLASSES_ROOT\CLSID\{Your Servers unique
CLSID}\InprocServer32 = Full Path to DLL
8. HKEY_CLASSES_ROOT\CLSID\{YourServers unique
CLSID}\LocalServer32 = Full Path to EXE
9. HKEY_CLASSES_ROOT\CLSID\{YourServers unique
CLSID}\InprocHandler32 = Full Path to DLL
-
This entry simply establishes your ProgID as a subkey of
the ROOT under which other subkeys can be entered. The description (the
value of this key) may be presented to the user as the name of an available
OPC server (See example below). It should match the description in line
6.
-
The CLSID line enables the CLSIDFromProgID function to work.
I.e. allows the system to open a key given the ProgID and obtain the CLSID
as the value of that key. See the example below.
-
The OPC line creates a flag subkey that has no value. This
was used for Data Access 1.0 to allow the client to browse for the available
OPC servers. As of verson 2.0, the prefered approach is for clients and
servers to use Component Catagories.
-
The Vendor line is optional. It is simply a means of identifying
the vendor who supplied the particular OPC server.
-
This line simply establishes your CLSID as a subkey off of
ROOT\CLSID under which the other subkeys can be entered. The description
(the value of this key) should be a User Friendly description of the
server. It should match Item 1 above.
-
The ProgID line enables the ProgIDFromCLSID function to work.
I.e. allows the system to open a key given the CLSID and obtain the ProgID
as the value of that key. (This function is not commonly used).
-
The InprocServer32 line or LocalServer32 line or InprocHandler32
line allows CoCreateInstance to locate the DLL or EXE given the CLSID.
The vendor should define at least one of these.
In general, self registration as described in the Microsoft
documentation is recommended for both DLL and EXE servers to simplify installation.
Registry Entries
for the Proxy/Stub DLL
The proxy/stub DLL is used for marshalling interfaces
to LOCAL or REMOTE servers. It is generated directly from the IDL code
and should be the same for every OPC Server. In general the Proxy/Stub
will use self registration. (Define REGISTER_PROXY_DLL during the build).
Since this is completely automatic and transparent it is not discussed
further.
Also note that a prebuilt and tested proxy/stub DLL will
be provided at the OPC Foundation Web site making it unnecessary for vendors
to rebuild this DLL.
Although vendors are allowed to add their own interfaces
to OPC objects (as with any COM object) they should NEVER modify the standard
OPC IDL files or Proxy/Stub DLLs to include such interfaces. Such interfaces
should ALWAYS be defined in a separate vendor specific IDL file and should
be marshalled by a separate vendor specific Proxy/Stub DLL.