问题描述
我有一个tlb文件,其中包含一些我需要使用的函数声明.
I have a tlb files that contains some function declaration that I need to use.
如果我使用
#import "type_library.tlb"
我可以从我的代码中正确引用该函数:
I can correclty reference the function from my code:
tlb_namespace::required_function();
但是当我编译项目时,链接器说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?
编辑:
我在Dummy VBA访问项目中使用了相同的类型库.我已将引用添加到类型库,并且我注意到类型库中包含的某些函数已正确调用.但是其中一些不是.VBA表示无法在相关的dll中找到其入口点.
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.
这可以解释在构建c ++应用程序时无法解析的外部符号吗?
Can this explain the unresolved external symbol when building c++ app?
我还注意到失败的函数在tlb中是这样声明的:
I have also noticed that the failing function are declared in the tlb like this:
UPPER_function_name
但是在dll中的声明如下:
but in the dll are declared like this:
Upper_function_name
这可能是问题吗?
是否可以解决这种错误,直接修改二进制tlb文件或dll?
Is it possible to solve this kind of error directly modifying the binary tlb file or dll?
推荐答案
使用IDE查看TLB信息.
使用此帮助:如何:查看类型库信息
Use IDE to view TLB information.
Use this help : How to: View Type Library Information
在IDE上:视图"->对象浏览器",单击"...",编辑自定义组件集,浏览您的TLB文件并添加以查看信息.
At IDE : View-> Object Browser, click "..." Edit Custom Component Set, browse your TLB file and Add to view information.
确认用于的名称空间.
这篇关于如何在本机C ++项目中使用tlb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!