Is js-ctypes still supported or is it deprecated

Skip to first unread message


Jan 20, 2021, 2:27:27 PM1/20/21
Hi there,
I'm not sure if this is the correct place to ask this but thought it was worth a try...

Is js-ctypes still "properly" supported by Spidermonkey or is it deprecated and going to disappear soon?
It looks like it is still there in the source code in spidermonkey 85 (there is a ctypes directory in src and there is a --enable-ctypes option to configure so it looks like it is all there (but I haven't tried to compile it or use it yet).

However if I go to there is a big red warning box saying

This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

I'm looking to see if can use ctypes to allow people to be able to call dlls from our JavaScript embedding. Nothing definite yet but before I even think about it I thought I should check whether this is a viable option or if it is shortly going to be removed.

Many thanks


Steve Fink

Jan 20, 2021, 2:46:29 PM1/20/21
to Miles,
There's not a single crisp answer to this question, but I can give you
the current status.

First, ctypes is currently used by the browser, so it is supported. The
JS shell defaults to having it off (and avoids an NSPR dependency with
it off), but SpiderMonkey is compiled with it enabled for browser builds.

However, I think people are trying to remove that usage. (I *think* it's
only used for an OS.File thing.)

I think that deprecation notice has been there for a long time, and is
mostly talking about how js-ctypes is nonstandard. Given that it's not
exposed to web content, nothing has really changed with respect to that
warning in a long time.

Additionally, and perhaps most relevant to you, people within the
SpiderMonkey team have been making noises about trying to get rid of it
entirely. I don't think anyone is actively planning on doing that
removal right now, and I'll get in the way somewhat because the static
rooting hazard analysis relies on it, but I'm sure I could come up with
some workaround to avoid that (eg by compiling my own shell with the
extensions I need instead of dynamically loading them; I control both

So: for now, it's available and supported, but it's not safe to assume
that it'll be around for the long haul.

Reply all
Reply to author
0 new messages