简体   繁体   English

C ++ 2 DLL相互使用

[英]C++ 2 DLL's using eachother

在c ++中是否可能包括彼此的2个DLL,因为它们每个都使用彼此的类(这是我的计划),这是否可行?

Yes, this is possible. 是的,这是可能的。 Only you need to compile these dlls as a multi step process. 只有您需要将这些dll作为多步过程进行编译。 To link a dll, you need a lib file from other dll. 要链接dll,您需要来自其他dll的lib文件。 This means that you need: 这意味着您需要:

  1. Create stub implementation of DLL1. 创建DLL1的存根实现。 This will produce a .lib file for DLL1. 这将为DLL1生成一个.lib文件。
  2. Link DLL2 with stub .lib pf DLL1. 将DLL2与存根.lib pf DLL1链接。
  3. Link DLL1 with real .lib of DLL2. 将DLL1与DLL2的真实.lib链接。
  4. Relink DLL2 with real lib of DLL1. 用DLL1的真实库重新链接DLL2。

Also note that DLLs in general have C interface. 另请注意,DLL通常具有C接口。 You can export classes, but be ready to have set of dlls for each version of used compiler. 您可以导出类,但准备为每个版本的使用的编译器提供一组dll。

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

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