NETLink`
NETLink`

LoadCOMTypeLibrary

LoadCOMTypeLibrary[library]

creates a so-called "interop" assembly from the named type library and loads that assembly.

Details and Options

  • To use LoadCOMTypeLibrary, you first need to load .NET/Link using Needs["NETLink`"].
  • The following options can be given:
  • SaveAssemblyAsNonea full pathname to the assembly file you want
    SafeArrayAsArrayFalsewhether to marshal SAFEARRAY types as System.Array
  • Once a type library has been loaded in this way, all its types will have managed equivalents created for them, so you can program with these types as if they were native .NET types.
  • LoadCOMTypeLibrary is the programmatic equivalent of running the tlbimp.exe tool that is part of the .NET Framework SDK.
  • The assembly can optionally be saved to disk (using the SaveAssemblyAs option) so that you do not have to call LoadCOMTypeLibrary in the future.
  • If you plan to do more in-depth work with COM objects described in a given type library, it is recommended that you use LoadCOMTypeLibrary or the tlbimp.exe tool to create an interop assembly and then use that assembly.