|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Customize Runtime Callable Wrappers
There are two ways to customize a runtime callable wrapper (RCW). If you can modify the Interface Definition Language (IDL) source, you can apply type library file (TLB) attributes and import the type library. Alternatively, you can apply interop-specific attributes to imported types and generate a new assembly. Support for customizing standard RCWs is limited by these attributes.
To modify the IDL source
Apply TLB attributes to libraries, types, members, and parameters. Use the custom keyword and an attribute value to change metadata. By applying TLB attributes, you can:
Specify the managed name of an imported COM type, instead of allowing the import utility to select the name according to standard conversion rules.
Explicitly define a destination namespace for the types in a COM library.
Compile the IDL source code.
Generate an assembly from the resulting type library file or from a dynamic link library file (DLL) that contains the type you intend to implement.
To modify an imported assembly
Import the type library file. Use the Type Library Importer (Tlbimp.exe) to generate an assembly DLL.
Create a text file from the imported assembly by using the MSIL Disassembler (Ildasm.exe).
Apply interop attributes to the text file.
Generate a new assembly from the modified text file by using the MSIL Assembler (Ilasm.exe).