【发布时间】:2017-03-02 04:58:13
【问题描述】:
我正在尝试将openvr binding 移植到 kotlin
我在java中有以下内容:
public class IVRSystem extends Structure {
/**
* C type : GetRecommendedRenderTargetSize_callback*
*/
public IVRSystem.GetRecommendedRenderTargetSize_callback GetRecommendedRenderTargetSize;
public interface GetRecommendedRenderTargetSize_callback extends Callback {
void apply(IntBuffer pnWidth, IntBuffer pnHeight);
};
}
Intellij 会自动将其翻译成
var GetRecommendedRenderTargetSize: IVRSystem.GetRecommendedRenderTargetSize_callback? = null
interface GetRecommendedRenderTargetSize_callback : Callback {
fun apply(pnWidth: IntBuffer, pnHeight: IntBuffer)
}
我后来改成了:
fun getRecommendedRenderTargetSize(pnWidth: IntBuffer, pnHeight: IntBuffer) = GetRecommendedRenderTargetSize_callback.apply(pnWidth, pnHeight)
interface GetRecommendedRenderTargetSize_callback : Callback {
fun apply(pnWidth: IntBuffer, pnHeight: IntBuffer)
}
但它抱怨
未解决的参考:应用
为什么?我该如何解决?
C++ 代码供参考
class IVRSystem
{
public:
virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0;
}
【问题讨论】:
标签: java intellij-idea interface kotlin jna