gpt4 book ai didi

c++ - 如何将外部库包含到 Haxe 中?

转载 作者:太空狗 更新时间:2023-10-29 21:41:20 24 4
gpt4 key购买 nike

我正在尝试编写一个程序,我想在 Haxe 中使用一些外部 C++ 库。我真的搞不懂,因为官方文档很旧 ( http://old.haxe.org/doc/cpp/ffi ),而且我也不熟悉 C++。

那么您如何在 Haxe 中做到这一点?我想我需要通过 haxelib 安装 hxcpp,但我知道的就这些了。<​​/p>

最佳答案

首先,查看 C++ Magic by Hugh Sanderson .该演讲中提到的大部分编译器元数据都可以在 Built-in Compiler Metadata 中找到。 Haxe 手册中的页面。

He then talks briefly about metadata magic. He provides metadata for classes and functions. For classes you have the following:

@:headerClassCode(...) which injects member variables and inline functions.
@:headerCode(...) which includes external headers.
@:headerNamespaceCode(...) which allows you to add to the global namespace.
@:cppFileCode(...) which allows you to include external headers only in C++ files.
@:cppNamespaceCode(...) which implements static variables.
@:buildXml(...) which allows you to add to the build.xml file.

For function metadata you get the following:

@:functionCode(...)
@:functionTailCode(...)

Hugh states these are largely redundant as you should use untyped __cpp_(...) instead.

关于c++ - 如何将外部库包含到 Haxe 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29129303/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com