Re: minisphere 2.1.6
Reply #911 –
I've read that Dr Dobb's article, and I'm not really a fan of how they do it.
I did about the simplest thing in TurboSphere. The API looked like this:
const char *Init(JSContext *ctx); // Returns the plugin name.
int GetNumFunctions(JSContext *ctx);
const char *GetFunctionName(JSContext *ctx, int i);
JSNative GetFunction(JSContext *ctx, int i);
int GetNumVariables(JSContext *ctx);
const char *GetVariableName(JSContext *ctx, int i);
void GetVariable(JSContext *ctx, int i, JSMutableHandle out); // It's much better to use an out-parameter for handles with SpiderMonkey.
void Close(); // Closes the plugin.
I'm still using a variant on that in UltraSphere/Turbo. I guess why complicate things, I never found I needed anything more than this. With how minisphere handles extensions, you could also add a GetExtension/GetNumExtensions component.
That's just my two cents from my own experiments.