PowerBuilder provides two ways to generate COM objects: in PowerBuilder COM servers or automation servers. Both are accessible from wizards and from the Project painter. PowerBuilder COM servers offer many more features than automation servers.
PowerBuilder COM servers PowerBuilder COM servers can contain more than one custom class user object. After you code the user objects, you use the Project painter to generate a single self-registering DLL for all the objects. You can also deploy the server directly to COM+ if it is running on the build computer, or create a COM+ package. PowerBuilder COM objects in a COM server can share runtime sessions, and references can be passed between objects created from the same COM client.
The COM server also contains an embedded PowerBuilder dynamic library (PBD) file that contains compiled versions of all the custom class user objects you selected and any dependent objects, as well as registry and type library information.
Automation servers Automation servers built from a PowerBuilder custom class user object contain only one object. After you code the user object, you build a runtime library from the PBL that contains it, and then use the Project painter to create a registry file and optional type library file. When you deploy the automation server, you customize the registry file for the user’s computer and then run the file to register the automation server.
You deploy the PowerBuilder virtual machine with an automation server or a PowerBuilder COM server, along with any other PowerBuilder runtime files the server requires.
Automation servers use a dispatch interface (also called dispinterface) that allows users to invoke methods on the server using the Invoke method of a standard COM interface called IDispatch.
COM servers can use custom or dual interfaces, which provide better performance than dispatch-based interfaces. A custom interface provides access to methods on the server through a virtual table (also called VTBL or vtable) that contains pointers to methods in the server’s interface. A dual interface enables the client to invoke methods using IDispatch::Invoke or a virtual table.
For more information, see “Choosing a custom or dual interface”.
Table 27-1 summarizes the differences between PowerBuilder automation servers and PowerBuilder COM servers using dual or custom interfaces:
Feature |
Automation server (dispatch interface) |
COM server (dual interface) |
COM server (custom interface) |
---|---|---|---|
In-process server support |
Yes* |
Yes |
Yes |
Generated IDL files |
No |
Yes |
Yes |
C++ client support |
No |
Yes |
Yes |
Java client support |
Yes |
Yes |
No |
PowerBuilder client support |
Yes |
Yes |
No |
Visual Basic 4 client support |
Yes |
Yes |
No |
Visual Basic 5 custom interface support |
No |
No |
Yes |
Support for PowerBuilder structures as instance variables and method argument types |
No |
No |
No |
Support for all C language datatypes |
No |
No |
No |
Support for an embedded type library |
No |
Yes |
Yes |
Self-registering servers |
No |
Yes |
Yes |
Support for DCOM # |
Yes |
Yes |
Yes |
Support for EAServer |
Yes |
Yes |
No |
Support for COM+ |
No |
Yes |
Yes |
Requires separate proxy/stub DLLs |
No |
No |
No |
Requires PowerBuilder runtime DLLs (minimally PBVM105.DLL and its dependencies) |
Yes |
Yes |
Yes |
Requires deployment of application runtime libraries built in Library painter |
Yes |
No |
No |
* In-process server is the PowerBuilder execution DLL (PBVM105.DLL)
# Requires use of surrogate host to house the PowerBuilder execution DLL