This topic has not yet been rated - Rate this topic

Imported Module Conversion 

A type library can have one or more modules containing the definitions of constants and methods. Constants defined within modules are imported as public constant static members of a class with the same name as the original module. Constants defined outside of a module are not imported.

Type library representation

[
    uuid(12345678-1234-1234-1234-123456789ABC),  
]
library TestConstants
{
    [
        uuid(12345678-1234-1234-1234-123456789ABC),  
        dllname("test.dll")
    ]
    module Constants
    {
        const short FRAME_COLOR = 0x10;
        const short WINDOW_COLOR = 0x20;
        const short BUTTON_COLOR = 0x40;
        …
    };
};

Converted types appear as follows:

public class Constants
{
    public const short FRAME_COLOR = 0x10;
    public const short WINDOW_COLOR = 0x20;
    public const short BUTTON_COLOR = 0x40;
}

See Also

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Methods inside modules are not imported
The type library importer ignores any methods inside modules.  If you wish to call such methods from managed code, you can manually define PInvoke signatures for each one.