简体   繁体   English

在Windows 7 Pro 32位中生成.tlb文件

[英]Generation of .tlb Files in Windows 7 Pro 32-bit

I have a C++ DLL that imports a .tlb file generated in a C# project. 我有一个C ++ DLL,可导入在C#项目中生成的.tlb文件。 The C++ DLL is a wrapper DLL containing functions that call the corresponding C# functions. C ++ DLL是包装DLL,其中包含调用相应C#函数的函数。

When I call the C++ functions on the computer that I built the projects, all works well. 当我在构建项目的计算机上调用C ++函数时,一切正常。 But when I copy the DLL's and generated tlb's to another computer with the same exact version of Windows and installed programs andI call the C++ functions, it breaks with a COM error. 但是,当我将DLL的文件并生成tlb的文件复制到另一台具有完全相同的Windows版本和已安装程序的计算机,并且我调用C ++函数时,它会因COM错误而中断。 However, after recompiling the projects on the new computer, everything works again. 但是,在新计算机上重新编译项目后,一切都会恢复。

I already checked the "Work on All Computers" for both projects but this keeps happening. 我已经检查了两个项目的“在所有计算机上工作”,但是这种情况一直在发生。 What else do I need to do for the DLL's to work on all computers? 为了使DLL在所有计算机上都能正常工作,我还需要做什么?

The HRESULT you get would be crucial to diagnose this. 您得到的HRESULT对诊断此问题至关重要。 Forced to guess: did you run Regasm.exe on that machine? 不得不猜测:您是否在该计算机上运行Regasm.exe? Required to make the necessary registry entries so COM can find the server. 进行必要的注册表项所需,以便COM可以找到服务器。 It is automatic when you build in the IDE. 在IDE中进行构建时,它是自动的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM