NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Appendix A - Type Library Importer Conversions

During the course of import information from a type library, the importer makes various data type conversions. The conversion rules used by TlbImp are captured below. Any type not explicitly listed below is converted to an I4. These types can then be manipulated with the helper routines found in the System.Runtime.InteropServices.Marshal class.

The following type library type Is imported as the following Element Type With the following MarshalAs Attribute System Type Built-in Language Type
        VB Mgd C++ C#
char, boolean, small I1    System.SByte n/a byte sbyte
wchar_t, short I2    System.Int16 short short short
long, int I4    System.Int32 integer long int
hyper I8    System.Int64 long __int64 long
unsigned char, byte UI1    System.Byte byte byte byte
unsigned short UI2    System.UInt16 N/A unsigned short ushort
unsigned long, unsigned int UI4    System.UInt32 N/A unsigned long uint
unsigned hyper UI8    System.UInt64 N/A unsigned __int64 ulong
single R4    System.Single single float float
double R8    System.Double double double double
VARIANT_BOOL Boolean VariantBool    boolean bool bool
void * I4

     n/a n/a n/a
HResult UI4 Error    n/a unsigned long uint
SCODE UI4 Error    n/a unsigned long uint
BSTR STRING BStr System.String string n/a string
LPSTR or
[string, …] char *
STRING LPStr System.String string n/a string
LPWSTR or
[string, …] wchar_t *
STRING LPWStr System.String string n/a string
VARIANT OBJECT    System.Object         
DECIMAL VALUETYPE
<System.Decimal>
   System.Decimal         
DATE VALUETYPE
<System.DateTime>
   System.DateTime         
GUID VALUETYPE
<System.Guid>
   System.Guid         
CURRENCY VALUETYPE
<System.Currency>
   System.Currency         
IUnknown * OBJECT Interface System.Object         
IDispatch * OBJECT Interface System.Object         
SAFEARRAY(type) SZARRAY(type) SAFEARRAY type[]         
typedef BaseType MyType BaseType               
MyStruct VALUETYPE
<MyStruct>
              
MyEnum VALUETYPE
<MyEnum>
              
MyInterface * CLASS <MyInterface> Interface            
MyCoClass CLASS
<_Class>
Interface            
Pointer Types
char *, boolean *, small * ByRef I1    System.SByte n/a byte sbyte
wchar_t *, short * ByRef I2    System.Int16 short short short
long *, int * ByRef I4    System.Int32 integer long int
hyper * ByRef I8    System.Int64 long __int64 long
unsigned char *, byte * ByRef UI1    System.Byte byte byte byte
unsigned short * ByRef UI2    System.UInt16 N/A unsigned short ushort
unsigned long *, unsigned int * ByRef UI4    System.UInt32 N/A unsigned long uint
unsigned hyper * ByRef UI8    System.UInt64 N/A unsigned __int64 ulong
single * ByRef R4    System.Single single float float
double * ByRef R8    System.Double double double double
VARIANT_BOOL * ByRef Boolean VariantBool    boolean bool bool
void ** ByRef I4

Add MashalAs attrib post PDC

   n/a n/a n/a
HResult * ByRef I4

Error    n/a unsigned short ushort
SCODE * ByRef I4

Error    n/a unsigned short ushort
BSTR * ByRef STRING BStr System.String string n/a string
LPSTR * ByRef STRING LPStr System.String string n/a string
LPWSTR * ByRef STRING LPWStr System.String string n/a string
VARIANT * ByRef OBJECT    System.Object         
DECIMAL * ByRef VALUETYPE
<System.Decimal>
   System.Decimal         
DATE * ByRef VALUETYPE
<System.DateTime>
   System.DateTime         
GUID * ByRef VALUETYPE
<System.Guid>
   System.Guid         
CURRENCY * ByRef VALUETYPE
<System.Currency>
   System.Currency         
IUnknown ** ByRef OBJECT Interface System.Object         
IDispatch ** ByRef OBJECT Interface System.Object         
SAFEARRAY(type) * ByRef SZARRAY(type) SAFEARRAY type[]         
typedef BaseType MyType ByRef BaseType               
MyStruct * ByRef VALUETYPE
<MyStruct>
              
MyEnum * ByRef VALUETYPE
<MyEnum>
              
MyInterface ** ByRef CLASS <MyInterface> Interface            
MyCoClass * ByRef CLASS
<_Class>
Interface