using Early Binding
As previously mentioned, using early binding means creating a reference to the COM component and then using that reference to interact with the component. IronPython doesn't support the standard methods of early binding that you might have used in other languages. What you do instead is create an interoperability DLL and then import that DLL into your application. The "Defining an Interop
DLL" section of the chapter describes this process in considerably more detail. Early binding provides the following benefits:
Faster execution: Generally, your application will execute faster if you use early binding because you rely on compiled code for the interop assembly. However, you won't get the large benefits in speed that you see when working with C# or Visual Basic.NET because IronPython itself is interpreted.
Easier debugging: In most cases, using early binding reduces the complexity of your application, making it easier to debug. In addition, because much of the access code for the COM component resides in the interop assembly, you won't have to worry about debugging it.
Fuller component access: Even though both early and late binding provide access to the component interfaces, trying to work through those interfaces in IronPython is hard. Using early binding provides you with tools that you can use to explore the interop assembly, and therefore discover more about the component before you use it.
Better access to enumerations and constants: Using early binding provides you with access to features that you might not be able to access when using late binding. In some cases, IronPython will actually hide features such as enumerations or constants when using late binding.
Post a comment