简体   繁体   English

Delphi-有关容器的C ++互操作性

[英]Delphi - C++ interoperability concerning containers

I have a C/C++ .dll containing core functionality of my program, and a Delphi project for the graphical user interface. 我有一个包含程序核心功能的C / C ++ .dll,还有一个用于图形用户界面的Delphi项目。 Is there any way I can export something like a std::vector or std::map to Delphi and use it in C++? 有什么办法可以将std :: vector或std :: map之类的内容导出到Delphi并在C ++中使用它?

Thanks in advance 提前致谢

C++ classes can only be directly consumed by C++ code. C ++类只能由C ++代码直接使用。 Similarly, Delphi classes can only be directly consumed by Delphi code. 同样,Delphi类只能由Delphi代码直接使用。

An exception to these rules is that Embarcadero's compilers have interop support and it is possible to consume some Delphi classes from C++ code, so long as the C++ code is compiled using an Embarcadero compiler. 这些规则的例外是,Embarcadero的编译器具有互操作支持,并且只要使用Embarcadero编译器编译C ++代码,就可以使用C ++代码中的某些Delphi类。

Assuming that you are not using an Embarcadero C++ compiler you will need to wrap any classes that you wish to export in an interop friendly manner. 假设您没有使用Embarcadero C ++编译器,则需要包装所有希望以互操作友好的方式导出的类。 The obvious choice for this is COM which was designed to solve this very problem. 显而易见的选择是COM,它旨在解决此问题。

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

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