.NET 符号从程序集中消失

发布于 2024-08-03 06:22:57 字数 1074 浏览 4 评论 0原文

我有一个使用本机 C++ 以及 C++/CLI 构建的项目。我有以下组件:

Assembly A  (C++/CLI)
 | uses
Assembly B  (C++/CLI)
 | uses
Static Lib C (Native C++)

我对 Static Lib C 进行了重大重写,它可以编译,其他使用它的本机项目也可以正常编译。重写时程序集 B 没有发生任何变化 - 正如预期的那样,当我编译程序集 B 时,它编译得很好,没有错误或警告。但是,当我尝试编译程序集 A 时,找不到程序集 B 中应该可用的任何符号,从而导致数百个错误。我尝试在 A 项目中添加和删除 B 和 C 作为引用,但没有成功。我尝试清理并从头开始重建一切 - 但仍然没有运气。我在 RedGate 的 Reflector 中加载了程序集 B,但看不到符号,所以至少这是一致的。我正在一个分支上工作,所以我从主干加载了程序集 B 的早期版本(并且它要求卸载我从分支加载的先前版本),并且我可以看到其中的所有符号。因此,当我在 Reflector 中查看当前版本的程序集 B 时,我看到:

+TFModelSetNETD, Version=1.0.3532.42171, Culture=neutral, PublicKeyToken=null
  +TFModelSetNETD.dll
    + References
      + {} -
      + <CppImplementationDetails>
      + <CrtImplementationDetails>
      + vc_attributes

仅此而已。在旧版本中,我看到这四个条目,加上在程序集 B、静态库 C、其他库中声明的所有命名空间,以及几个 boost 和 std 命名空间。我应该提到这是在 Visual Studio 2008 中。

对于这里发生的事情有什么想法吗?我只是不明白我可以做什么来使编译器不导出任何符号,而不给我任何类型的警告。

想法、技巧或调试建议都非常感谢。

编辑:我已将静态库 C 加载到 LibDump 中,并且所有符号都在那里 - 但是,在使用 Redgate Reflector 检查时,在程序集 B 中定义的符号或从静态库 C 引用的符号在程序集 B 中均不可见。

I have a project that is built with native C++, as well as C++/CLI. I have the following components:

Assembly A  (C++/CLI)
 | uses
Assembly B  (C++/CLI)
 | uses
Static Lib C (Native C++)

I did a major re-write of Static Lib C, and it compiles, and other native projects that use it compile fine as well. None of Assembly B changed in the re-write - and as expected, when I compile Assembly B it compiles fine with no errors or warnings. However, when I try to compile Assembly A, none of the symbols that are supposed to be available in Assembly B can be found, causing hundreds of errors. I tried adding and removing B and C as references in the A project with no luck. I tried doing a clean, and rebuilding everything from scratch - but still no luck. I loaded Assembly B up in RedGate's Reflector, and I can not see the symbols, so at least that's consistent. I'm working on a branch, so I loaded an earlier version of Assembly B from the trunk, (and it asked to unload the previous version I had loaded from my branch), and I could see all the symbols in it. So when I look at my current version of Assembly B in Reflector, I see:

+TFModelSetNETD, Version=1.0.3532.42171, Culture=neutral, PublicKeyToken=null
  +TFModelSetNETD.dll
    + References
      + {} -
      + <CppImplementationDetails>
      + <CrtImplementationDetails>
      + vc_attributes

And that is all. In the older version, I see these four entries, plus all my namespaces declared in Assembly B, Static Lib C, other libs, plus several boost and std namespaces. I should mention this is in Visual Studio 2008.

Any ideas as to what is going on here? I just can't understand what I could have done to make the compiler not export any symbols, without giving me any kind of warning.

Ideas, tips, or debugging suggestions are all greatly appreciated.

Edit: I have loaded the Static Lib C into LibDump, and all the symbols are there - however, none of the symbols either defined in Assembly B, or referenced from Static Lib C are visible in Assembly B when examining it with Redgate Reflector.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最偏执的依靠 2024-08-10 06:22:57

发生的情况是,相关符号的头文件从未包含在任何地方的 cpp 文件中。我对其工作原理的唯一解释是,也许其他编译单元之一间接包含了有问题的标头,但是当它在重写中发生更改时,符号不再包含在任何地方。不管你相信与否,与我遇到的下一个问题相比,这个问题很容易 - boost::thread 导致程序集在加载时抛出异常,因为与 DLL 初始化和线程本地存储相关的冲突。

What happened was that the header files for the symbols in question were never being included in a cpp file anywhere. The only explanation I have for why it worked is that maybe one of the other compilation units included the headers in question indirectly, but when it changed in the rewrite, the symbols were no longer being included anywhere. Believe it or not this problem was easy compared to the next one I hit - boost::thread causing the assembly to throw an exception on load because of conflicts relating to DLL initialization and thread-local storage.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文