Lua-Lgi: Graphene: how to call methods with `out caller-allocates` as function parameters

I try to call Graphene methods from lgi which return their result as out caller-allocates.

For example the last argument of void graphene_vec2_normalize (const graphene_vec2_t *v, graphene_vec2_t *res); is an out caller-allocate and the return location of the calculated normalized vector.

The following code is a minimal working example that exits with a segmentation fault on calling graphene_vec2_normalize

local Graphene = require'lgi'.Graphene
local Vec2 = Graphene.Vec2

local vec = Vec2.init( Vec2.alloc(), 10, 23 )

print(vec:get_x(), vec:get_y()) -- stdout >> 10 23

Vec2.normalize(vec) -- segmentation fault

Maybe someone around here knows how to call methods from the Graphene library from Lua-lgi and can provide me a solution!?

Best regards

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.