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

▼魔方 西西 提交于 2021-01-27 05:59:12

问题


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?


回答1:


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.




回答2:


use the namespace to resolve the linker error: example: #import "<>" raw_interfaces_only using namespace <>

this will resolve the problem



来源:https://stackoverflow.com/questions/15381440/how-to-use-tlb-files-in-a-native-c-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!