JS ctypes will not be available to webextensions. We are on a path so that
all Firefox extensions will be webextensions, and so at some point ctypes
will not be available. We don't have a firm timeline for that process.
The GC hazard is typically something like this:
function outptr() {
let intvalue = ctypes.int64_t(0);
let intptr = intvalue.address();
return intptr;
}
// call a function of the form bool string_to_int64(char* s, int64_t*
result)
let result = outptr();
let ok = string_to_int64("123467789", result);
let value = result.contents();
This is not safe code because the pointer can live longer than the thing
it's pointing to. This is especially true if there is anything asynchronous
about the code: if you're using callback functions you have to make sure
that *everything* is rooted across the call.
Also, you're marshalling data types mostly by hand. It's just not a
reliable long-term engineering solution for most things.
--BDS