I want to create a struct from c, but get an exception “Native interop types constructors must not be called directly” , so i use
alloc<*>
instead.
Is it a way to invoke constructor function when i call
alloc<*>
? because the params is final in klib, i can not assign value after
alloc<*>
.
my code:
Copy code
memScoped {
val info = alloc<GrMtlTextureInfo>()
info.fTexture = _texture.objcPtr() // fTexture is final in klib
renderTarget = GrBackendRenderTarget(480, 320, 1, info.reinterpret())
}
d
Dominaezzz
05/20/2021, 11:31 AM
C doesn't have constructors though. Do you just want to call some random C function?
Dominaezzz
05/20/2021, 11:32 AM
Is fTexture const?
l
Luoqiaoyou
05/20/2021, 12:15 PM
I m using Skia, it is a C++ library, which is not supported by the K/N. Maybe that’s the reason