#1 2014-06-22 02:55:02

win2014
Member
Registered: 2014-06-10
Posts: 31

JS_SetRuntimePrivate and JS_GetRuntimePrivate can not locate on the SM

When I use JS_SetRuntimePrivate or JS_GetRuntimePrivate in SynSM, the app directly crash! And then show "Can not locate the program import point JS_SetRuntimePrivate..".

Offline

#2 2014-06-23 10:16:13

win2014
Member
Registered: 2014-06-10
Posts: 31

Re: JS_SetRuntimePrivate and JS_GetRuntimePrivate can not locate on the SM

I had fixed this, see below:

function JS_GetRuntimePrivate(rt: PJSRuntime): pointer; cdecl; external SpiderMonkeyLib name '?JS_GetRuntimePrivate@@YAPAXPAUJSRuntime@@@Z';
procedure JS_SetRuntimePrivate(rt: PJSRuntime; data: pointer); cdecl; external SpiderMonkeyLib name '?JS_SetRuntimePrivate@@YAXPAUJSRuntime@@PAX@Z';

Offline

#3 2014-06-24 09:11:23

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: JS_SetRuntimePrivate and JS_GetRuntimePrivate can not locate on the SM

It should be fixed IMHO at .dll level.

mpv, are you there to help?
smile

Offline

#4 2014-07-03 10:43:19

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,543
Website

Re: JS_SetRuntimePrivate and JS_GetRuntimePrivate can not locate on the SM

Really - we do not patch these functions to be visible from C (Delphi) code. Signatures you found is for C++. But my recommendation - do not use it (some external libs may also use runtime privat). Since we have one runtime & one context per thread you can store your runtime-related data in the threadvar (or using the way  TSQLDBConnectionPropertiesThreadSafe.ThreadSafeConnection or TSMEngineManager.CurrentThreadEngine work)

Offline

#5 2014-07-03 10:46:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: JS_SetRuntimePrivate and JS_GetRuntimePrivate can not locate on the SM

+1 for threadvar

And you can sub-class your custom TSMEngine class and use TSMEngineManager.CurrentThreadEngine to retrieve the current running instance.

Or if you are using our mORMot interface-based services, you can use sicClientDriven kind of instance life-time.

Offline

Board footer

Powered by FluxBB