none
missing data type in tlb RRS feed

  • Question

  • Given C# .Net modules A and B. I encountered a circular dependency with a data object. I decided against an adapter for performance reasons. Therefore I created module C that is nothing but the data object and and interface. I set comvisble to true on the interface and the class for module C. Module A has a method Foo(IdataObjectFromModuleC a) which uses the data object from in the form of the interface from module C. I expose the class that contains Foo() and the interface that encapsulates the class. I generate the .tlb's for both A and C. However the .tlb for module A is not correct. the .tlh has the following information    HRESULT Foo (
            __missing_type__ * dataEvent ); 

    I am using the .Net reference mechanism to pull C into A. I was playing with tlbexp.exe and the /tlbreference to try to pull C in, but have failed as the output window says it cannot open the tlb because it was deleted , renamed , or moved. This I dont understand as it is in the path listed in the output window. Any thoughts on solutions, without just including the data type in project A and making an adapter so that module B can use it? I am currently trying to create an interop dll for module C and I can try to pull that in, instead of the .Net reference to C, but that doesnt feel right

     

    thanks for any thoughts

    • Moved by Larcolais Gong Tuesday, February 1, 2011 8:23 AM (From:Visual C# IDE)
    Monday, January 31, 2011 9:14 PM

Answers

  • Hello Tyboriel,

     

    There are several things you need to do :

     

    1. Ascertain that Module C's TLB is referenced by Module A's TLB. This establishes that Module C's TLB is a dependent TLB.

    1.1 Open the TLB file for Module A (ModuleA.tlb, say) via the OLE/COM Object Viewer.

    1.1.1 Check to see whether the TLB for Module C (ModuleC.tlb, say) is referenced inside ModuleA.tlb.

    If ModuleC.tlb is indeed referenced inside ModuleA.tlb, then the following "importlib" statement will be listed :

    library ModuleA
    {
        importlib("ModuleC.tlb");
        // TLib : mscorlib.dll : {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}
        importlib("mscorlib.tlb");
     ...
     ...
     ...
    }

     

    2. Next, make sure that the ModuleC.tlb Type Library is registered. The reason for this will be clear as the next point is expounded.

    2.1 One good way to register ModuleC.tlb is by registering the ModuleC assembly via RegAsm.exe (with the /tlb flag), e.g. :

    regasm ModuleC.dll /tlb

     

    3. When you #import the "ModuleA.tlb" in your C++ project, make sure to use the auto_search option, e.g. :

    #import "ModuleA.tlb" auto_search

    This way, referenced dependency type libraries will be searched for by the compiler.

    3.1 This is where the benefits of registering ModuleC.tlb comes in. By specifying the auto_search option, the compiler will search for the location of ModuleC.tlb by looking up the registry.

    3.2 Note that if ModuleC.tlb is not registered, you may still succeed in the #import process if you copy ModuleC.tlb into the C++ project folder.

     

    Hope the above will be helpful to you.

    - Bio.

     

    • Marked as answer by eryang Monday, February 14, 2011 8:02 AM
    Tuesday, February 1, 2011 3:51 PM

All replies

  • Hi,

    I'll help you moving your thread into appropriate forum.

    Best Regards,

    Larcolais


    Larcolais Gong[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 1, 2011 8:23 AM
  • Hello Tyboriel,

     

    There are several things you need to do :

     

    1. Ascertain that Module C's TLB is referenced by Module A's TLB. This establishes that Module C's TLB is a dependent TLB.

    1.1 Open the TLB file for Module A (ModuleA.tlb, say) via the OLE/COM Object Viewer.

    1.1.1 Check to see whether the TLB for Module C (ModuleC.tlb, say) is referenced inside ModuleA.tlb.

    If ModuleC.tlb is indeed referenced inside ModuleA.tlb, then the following "importlib" statement will be listed :

    library ModuleA
    {
        importlib("ModuleC.tlb");
        // TLib : mscorlib.dll : {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}
        importlib("mscorlib.tlb");
     ...
     ...
     ...
    }

     

    2. Next, make sure that the ModuleC.tlb Type Library is registered. The reason for this will be clear as the next point is expounded.

    2.1 One good way to register ModuleC.tlb is by registering the ModuleC assembly via RegAsm.exe (with the /tlb flag), e.g. :

    regasm ModuleC.dll /tlb

     

    3. When you #import the "ModuleA.tlb" in your C++ project, make sure to use the auto_search option, e.g. :

    #import "ModuleA.tlb" auto_search

    This way, referenced dependency type libraries will be searched for by the compiler.

    3.1 This is where the benefits of registering ModuleC.tlb comes in. By specifying the auto_search option, the compiler will search for the location of ModuleC.tlb by looking up the registry.

    3.2 Note that if ModuleC.tlb is not registered, you may still succeed in the #import process if you copy ModuleC.tlb into the C++ project folder.

     

    Hope the above will be helpful to you.

    - Bio.

     

    • Marked as answer by eryang Monday, February 14, 2011 8:02 AM
    Tuesday, February 1, 2011 3:51 PM