Struct pointer from js callback function

I am trying to get a JS callback function with a struct as a parameter to run from C code

typedef void (*test_callback)(struct mg_str msg, void *param);

void test_function(test_callback cb, void *cb_arg)
{
LOG(LL_INFO, (“test_Function”));
cb(mg_mk_str(“passing string”), cb_arg);
}

JS Code
let test = ffi(‘void test_function(void()(void, userdata), userdata)’);

test(function (t) {
print(‘callback from js’);
}, null);

The app is crashing with a Guru Meditation Error when the callback is executed.

You can FFI the struct mg_str *, but not struct mg_str. Please use the pointer.

thanks i am able to make it work with the pointer.