Edoardo Luppi
08/03/2023, 4:37 PMCreateThread function, how do I correctly pass a this reference (as a pointer) as a parameter to entryPoint?
CreateThread(
lpThreadAttributes = null,
dwStackSize = 0u,
lpStartAddress = staticCFunction(::entryPoint),
lpParameter = this,
dwCreationFlags = 0u,
lpThreadId = null,
)
...
private fun entryPoint(parameter: COpaquePointer?): UInt {
TODO()
}Landry Norris
08/03/2023, 5:05 PMEdoardo Luppi
08/03/2023, 5:12 PMStableRef.create(this).asCPointer()Landry Norris
08/03/2023, 5:13 PMEdoardo Luppi
08/03/2023, 5:15 PMthis, like I'm creating a stable ref to myself basicallyEdoardo Luppi
08/03/2023, 5:15 PMEdoardo Luppi
08/03/2023, 5:16 PMstaticCFunction, I suppose that's ok as it is now.Landry Norris
08/03/2023, 5:18 PMEdoardo Luppi
08/03/2023, 5:20 PMdispose function, to be used by clients.
I suppose I'll dispose the StableRef inside disposeEdoardo Luppi
08/03/2023, 5:28 PMparameter: COpaquePointer?
This parameter will end up representing the this instance.
How do I dereference the pointer and change its representation to this class?Landry Norris
08/03/2023, 5:29 PMEdoardo Luppi
08/03/2023, 5:32 PMparameter?.asStableRef<MyClass>()?.get()Dominaezzz
08/03/2023, 11:26 PMStableRef in your staticCFunction as the very first thing it does.Edoardo Luppi
08/04/2023, 10:56 AM