简体   繁体   English

如何使用Haxe的第三部分dll

[英]How to use third part dll from Haxe

我正在启动项目,我将不得不使用在纯C上编写的外部dll。如何加载外部dll(NOT.Net libtaty,如果它很重要)从Neko或Cpp目标在Haxe中使用它?

I found out the answer on my question. 我在问题上找到了答案。 It is trivial, no nedded special settings for the compiller, no special list of dynamic loaded libraries at compile time. 它是微不足道的,没有针对编译器的嵌入式特殊设置,在编译时没有特殊的动态加载库列表。

Just load library at runtime using haxe cpp API like below: 只需在运行时使用haxe cpp API加载库,如下所示:

static var sum:Int->Int->Int = cpp.Lib.load("test","sum",2);

or haxe neko API according to your target platform: 或根据您的目标平台haxe neko API:

static var sum:Int->Int->Int = neko.Lib.load("test","sum",2);

This lines load sum function from test library which located in the same directory with executable file. 这行加载来自test库的sum函数,该库与可执行文件位于同一目录中。

Read more about it in old haxe documentation. 在旧的haxe文档中阅读更多相关信息。

[1]: http://old.haxe.org/doc/cpp/ffi C Foreign Function Interface [1]: http//old.haxe.org/doc/cpp/ffi C外部函数接口

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

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