none
.net4 tlbimp problem RRS feed

  • Question

  • It seems that tlbimp  for .net4  looses initialization of constant for typedefs:

    idl code  : 

       typedef [public]  DWORD MAGNIFICATION;                         
       typedef [public]  DWORD LIGHT_SOURCE;
     
       module  HWTYPES 
       {
              const  MAGNIFICATION  MAG1 =1;
    	  const  LIGHT_SOURCE   LS2 = 2;
    	  const  DWORD		DW3 = 2;
       };
    

    C# code after converted with .net4 tlbimp: 

    public static class HWTYPES
    {
        // Fields
        public const uint DW3 = 2;
        [ComAliasName("KLATencor.Atlas.Common.Types.LIGHT_SOURCE")]
        public const uint LS2;
        [ComAliasName("KLATencor.Atlas.Common.Types.MAGNIFICATION")]
        public const uint MAG1;
    }
    

    C# code after converted with .net2  tlbimp 

    public abstract class HWTYPES
    {
        // Fields
        public const uint DW3 = 2;
        [ComAliasName("AtlasHardwareTypesLib.LIGHT_SOURCE")]
        public const uint LS2 = 2;
        [ComAliasName("AtlasHardwareTypesLib.MAGNIFICATION")]
        public const uint MAG1 = 1;
    }
    

    Please advise why this happens. and how we can solve it. we have as lot of code with this pattern and our applications are not running  after migration to vs2010 and .net4.

      
    Tuesday, May 29, 2012 3:58 PM

All replies

  • What is IDL code? Another language?

    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    Wednesday, May 30, 2012 8:42 AM
  • IDL is a language to define interfaces and types for COM.

    We use  to share types between C++ and  .Net.

    IDL is compiled by MIDL compiler which generates  header files for C++ , and also creates tlb file . tlb file is converted by tlbimp to a .net assembly.

    Wednesday, May 30, 2012 11:30 AM
  • Hi ,

    It may be a bug, report it: http://connect.microsoft.com/VisualStudio/ 

    Have a nice day.


    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    Thursday, May 31, 2012 11:04 AM