从 C# 调用 C++/CLI 构造函数时出错
我试图通过以下代码片段在 SlimDX 中使用 StateBlock 来保存和恢复状态:
StateBlockMask mask = new StateBlockMask(null) { RasterizerState = true };
var sb = new StateBlock(device.Device, mask);
StateBlockMask 和 StateBlock 都是类。这给了我一个编译错误:
'.ctor' is not supported by the language
从这里的其他一些帖子中阅读,这似乎是一个与使用错误的参数调用托管代码有关的问题。在SlimDX的源代码中,我发现:
StateBlock::StateBlock(SlimDX::Direct3D10::Device^ device, StateBlockMask mask)
我对C++/CLI没有任何经验,所以我想知道这里是否有问题(例如缺少或多余的^),或者我应该将故障集中在我这边?
(注意:这个问题已交叉发布到gamedev.net,未来有相同问题的用户可能也想检查那里给出的答案)
I am trying to save and restore state by using a StateBlock in SlimDX via the following snippet:
StateBlockMask mask = new StateBlockMask(null) { RasterizerState = true };
var sb = new StateBlock(device.Device, mask);
Both StateBlockMask and StateBlock are classes. This gives me a compilation error:
'.ctor' is not supported by the language
Reading from some other posts here on SO, it seems that this is a problem that has to do with calling the managed code with the wrong arguments. In the source of SlimDX, I find:
StateBlock::StateBlock(SlimDX::Direct3D10::Device^ device, StateBlockMask mask)
I have no experience at all with C++/CLI, so I am wondering if there is something wrong here (like a missing or extra ^), or should I concentrate of faults on my side?
(NOTE: This question has been cross-posted to gamedev.net, future users with the same question may also want to check for answers given there)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
StateBlockMask 是一个结构吗?如果没有,请在 C++ 构造函数中使用
StateBlockMask^ mask
。Is
StateBlockMask
a struct? If not, useStateBlockMask^ mask
in the C++ constructor.这看起来像是 SlimDX 中的一个错误。您可能需要使用问题跟踪器来确保问题得到正确处理。
This looks like a bug in SlimDX. You might want to use the issue tracker to make sure it gets dealt with properly.