Adam S
12/14/2023, 12:16 PMdata class MyVec2(val x: Float, val y: Float)
and an equivalent C struct
typedef struct Vec2 {
float x;
float y;
} Vec2;
and a C function that takes a pointer to a vector
some_function(Vec2 *value)
When I call this function from Kotlin do I need a memory scope to create and pass a Vec2 pointer, or is it possible without? I want to be able to instantiate vectors without a memory scope (because most of the time passing a pointer is not necessary, so it adds some overhead/complexity that I'd like to avoid)Jan Holešovský
12/15/2023, 6:49 AMAdam S
12/16/2023, 9:10 AMAdam S
12/16/2023, 9:11 AMAdam S
12/17/2023, 10:30 PMnativeHeap.alloc<Vec2> { x = 1f; y = 2f }
is ~5 times slower than MyVec2(x = 1f, y = 2f)
Jan Holešovský
12/17/2023, 10:34 PMAdam S
12/17/2023, 10:37 PMJan Holešovský
12/17/2023, 10:42 PMAdam S
12/17/2023, 10:55 PMKrystian
12/18/2023, 10:27 AMAdam S
12/19/2023, 12:39 PMVec2Var
Kotlin class, similar to how there's a IntVar
, specifically for passing a pointer into C functions and reading the valueAdam S
12/19/2023, 12:40 PMJan Holešovský
12/19/2023, 12:43 PM