Next: Creating Type Libraries for COM objects, Previous: What are COM Objects and Interfaces? [Contents][Index]

## 3 Using COM objects with GNAT

COM objects can be used via two methods, the Static method, by calling methods of its interfaces, or the dynamic method if it supports IDispatch, as most do, by calling the Invoke method of the IDispatch interface using property and method IDs. The second method is the only one available to scripting languages (such as VBScript and JavaScript) and invocation speed is generally four to ten times slower then the first method. GNAT can access COM objects using both methods.

Complete examples of both methods are available with the GNAT examples. `COM_Static.adb` demonstrates the static method and `COM_Dynamic.adb` demonstrates the dynamic method.