作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在尝试使用 Haxe 生成从用 C++/CLR 编写的 dll 中调用方法的 C# 代码。这个dll叫做“AudioClientSDK.dll”
这是我正在尝试的 Haxe 代码示例:
package hello;
class HelloWorld {
static public function main():Void {
var s = untyped __cs__("AudioClientCLR.AudioClientAPI.release()");
}
}
如您所见,我正在使用“Haxe magic”语法(我之前尝试过导致几乎相同问题的 Haxe extern 类)直接调用 AudioClientSDK.dll 中的 release 方法。 dll中的方法签名是:
public : void AudioClientCLR::AudioClientAPI::release()
但是,当我尝试编译这段代码时,Haxe 抛出了这个错误:
haxe -cp src -cs out/CS -main hello.HelloWorld
haxelib run hxcs hxcs_build.txt --haxe-version 3103
c:\git\HelloHaxe\src\hello\HelloWorld.hx(6,16): error CS0103: The name
'AudioClientCLR' does not exist in the current context
Compilation error
Native compilation failed
Error: Build failed
如果我尝试将 AudioClientSDK.dll 引用作为 -net-lib 或 -net-std 传递,我会收到以下错误:
haxe -cp src -cs out/CS -net-lib lib/CPP/x86/AudioClientSDK.dll -main hello.HelloWorld
File "ilMetaReader.ml", line 281, characters 36-42: Assertion failed
error 0x2
haxe -cp src -cs out/CS -net-std lib/CPP/x86/AudioClientSDK.dll -main hello.HelloWorld
Error: No .NET std lib directory with the pattern 'net-20' was found in the -net-std search path. Try updating the hxcs lib to the latest version, or specifying another -net-std path.
你们知道如何正确使用dll吗?
提前致谢。
附言这些是 AudioClientSDK.dll 的一些属性:
另外,请注意,此 dll 可以在 Visual Studio 中使用 C# 而不会出现问题。
最佳答案
这似乎是一个错误。请尽快将它报告给 haxe 问题列表,并提供指向有问题的 dll 的可下载链接,它可能会包含在 3.2 最终版本中
关于Haxe:如何在 haxe 代码中使用 .NET C++/CLI dll?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29612940/
我是一名优秀的程序员,十分优秀!