简体   繁体   中英

VS 2005 can't find .NET DLL class definitions even after Regasm

I have an unmanaged C++ project that uses a third-party .NET dll. It builds fine on one machine, but not on another--the IDE can't find the class definitions.

I ran RegAsm.exe TheLib.dll /codebase /tlb:TheLib.tlb , and the registry entries on the two machines match. That is, even though the IDE says that TheLib.Function() is undefined, it's there in the registry on both machines.

What could I be doing wrong? (The source on the two machines is checked out of the same repository, and there are no uncommitted or unversioned files.)

This can sometimes happen if you don't properly export classes or functions from your library. Even though the code is there and it compiles fine when it links it may omit definitions or not actually generate exports to functions. So then other projects importing the lib show them as being undefined.

This article describes a good way to export classes from a DLL and is worth a read as it could be related to your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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