How to use tlb files in a native C++ project

23,237

Use IDE to view TLB information.
Use this help : How to: View Type Library Information

At IDE : View-> Object Browser, click "..." Edit Custom Component Set, browse your TLB file and Add to view information.

Confirm namespace used for.

Share:
23,237
sblandin
Author by

sblandin

Updated on September 02, 2020

Comments

  • sblandin
    sblandin over 3 years

    I have a tlb files that contains some function declaration that I need to use.

    If I use

    #import "type_library.tlb"
    

    I can correclty reference the function from my code:

    tlb_namespace::required_function();
    

    But when I compile the project the linker says that tlb_namespace::required_function is an unresolved external symbol.

    How can I succesfully build this kind of project?

    EDIT:

    I have used the same type library in a Dummy VBA access project. I have added the reference to the type library and I have noticed that some of the function contained in the type library are correctly called. But some of them are not. VBA says It can't locate their entry point in the related dll.

    Can this explain the unresolved external symbol when building c++ app?

    I have also noticed that the failing function are declared in the tlb like this:

    UPPER_function_name
    

    but in the dll are declared like this:

    Upper_function_name
    

    Can this be the issue?

    Is it possible to solve this kind of error directly modifying the binary tlb file or dll?

  • sblandin
    sblandin about 11 years
    Sorry for the late feedback. If I open the tlb file in the object browser I see it as a library containing a single namespace which contains a number of modules that group some functions. When I #import the tlb in a native C++ project I get a namespace containing only function. As I said before adding a reference to the tlb in a VBA project allows me to call the functions, but in a native C++ project I get linker error.