You are not logged in.
Pages: 1
After a long time I have try to upgrade my Synopse with last timeline version (2020-05-14 16:06:21).
On Delphi 10.3 I get these errors:
[dcc32 Error] SyNodeRemoteDebugger.pas(224): E2003 Undeclared identifier: 'SafePush'
[dcc32 Error] SyNodeRemoteDebugger.pas(525): E2003 Undeclared identifier: 'SafePush'
[dcc32 Error] SyNodeRemoteDebugger.pas(602): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(603): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(620): E2010 Incompatible types: 'TRawUTF8ListLocked' and 'TRawUTF8List'
[dcc32 Error] SyNodeRemoteDebugger.pas(621): E2010 Incompatible types: 'TRawUTF8ListLocked' and 'TRawUTF8List'
[dcc32 Error] SyNodeRemoteDebugger.pas(683): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(684): E2003 Undeclared identifier: 'SafeClear'
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2003 Undeclared identifier: 'SafePop'
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2015 Operator not applicable to this operand type
[dcc32 Error] SyNodeRemoteDebugger.pas(777): E2015 Operator not applicable to this operand type
[dcc32 Fatal Error] SyNode.pas(1319): F2063 Could not compile used unit 'SyNodeRemoteDebugger.pas'
Offline
@array81 - wokring SyNode version is currently in feature/synodeCleanup brunch. I try to keep it in sync with master..
I have try to use https://github.com/synopse/mORMot/tree/ … odeCleanup but this is the result:
[dcc32 Error] SpiderMonkey.pas(600): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(601): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(602): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(603): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(604): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(605): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(606): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(607): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(609): E2398 Class methods in record types must be static
[dcc32 Error] SpiderMonkey.pas(2026): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2026): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2028): E2070 Unknown directive: 'JS_DisableExtraThreads'
[dcc32 Error] SpiderMonkey.pas(2029): E2004 Identifier redeclared: 'external'
[dcc32 Error] SpiderMonkey.pas(2029): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2043): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2044): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2044): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2047): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2048): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2048): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2051): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2052): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2052): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2055): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2056): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2056): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2060): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2061): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2061): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2065): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2066): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2066): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2069): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2072): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2072): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Error] SpiderMonkey.pas(2074): E2029 Type expected but 'TYPE' found
[dcc32 Error] SpiderMonkey.pas(2075): E1030 Invalid compiler directive: 'external'
[dcc32 Error] SpiderMonkey.pas(2075): E2029 ',' or ':' expected but identifier 'name' found
[dcc32 Fatal Error] SpiderMonkey.pas(2075): E2226 Compilation terminated; too many errors
Offline
Is there any news on this ? As @array81 reported, latest mORMot and SyNode are incompatible with each other when Delphi is used.
Offline
The following regex could be helpful to alleviate the burden to support Delphi compatibility of SpiderMonkey.pas
(?gs)type\s([_A-Za-z]+)\s*=\s*(function|procedure)(.*?cdecl;)\s*var(\s[_A-Za-z]+):\s*([_A-Za-z]+)\s(external.*?;)
Offline
I can resolve an error "Class methods in record types must be static" - it's not a problem.
Problem is about E1030 Invalid compiler directive: 'external'
SpiderMonkey itself is a C++, so we need to export a C++ function as a cdecl.
To avoid unnecessary function call we export a variable what contains pointer to a C++ function from our wrapper - see synsm.h line 10 for example as such:
extern "C" {
JS_PUBLIC_API(bool) (*SM_Initialize)(void) = &JS_Init;
SM_Initialize is a pointer to a function.
And when import it in the SpiderMonkey.pas using
type TJS_Initialize = function : Boolean; cdecl;
var JS_Init: TJS_Initialize external SpiderMonkeyLib name 'SM_Initialize';
I don't know how to do such in Delphi.
Last edited by mpv (2020-08-17 10:29:30)
Offline
If the following two code blocks are equivalent to each other, the regex posted above could be used to automatically transform the hundreds of declarations in SpiderMonkey.pas
current
type TJS_Initialize = function : Boolean; cdecl;
var JS_Init: TJS_Initialize external SpiderMonkeyLib name 'SM_Initialize';
Delphi compatible
function SM_Initialize: Boolean; cdecl; external SpiderMonkeyLib name 'SM_Initialize';
type TJS_Initialize = function : Boolean; cdecl;
var JS_Init: TJS_Initialize = SM_Initialize; // external SpiderMonkeyLib name 'SM_Initialize';
Last edited by ComingNine (2020-08-17 11:21:14)
Offline
@ComingNine - `SM_Initialize` exported by SpiderMonkeyLib is a pointer to function, not a function. So
function SM_Initialize: Boolean; cdecl; external SpiderMonkeyLib name 'SM_Initialize';
not works (at last in FPC I got AV).
Did you verify your code in Delphi? It's work?
Offline
Thank you for your efforts ! IIRC, to realize a pointer to external function in Delphi (and FPC as well), one does not use external keyword but SafeLoadLibrary followed by GetProcAddress. I have to try and return.
Last edited by ComingNine (2020-08-17 13:14:27)
Offline
...
To avoid unnecessary function call we export a variable what contains pointer to a C++ function from our wrapper - see synsm.h line 10 for example as such:extern "C" { JS_PUBLIC_API(bool) (*SM_Initialize)(void) = &JS_Init;
SM_Initialize is a pointer to a function.
...
Could you help to suggest how to build your wrapper SynSM.sln ?
When I open the solution in Visual Studio 2015, there are many errors that are related to includes. For example, "jspubtd.h" cannot resolve "#include "mozilla/Assertions.h"". In the file system, "Assertions.h" is under "mozilla-esr52\mfbt\Assertions.h" not "mozilla"... This seems to be a rather basic problem, since the instructions to build SpiderMonkey itself works, but I am not familiar with C++ or SpiderMonkey. Could you suggest what one needs to do to proceed ? Many thanks !
Last edited by ComingNine (2025-07-02 09:49:59)
Offline
The last time I compiled this was in 2020. I'll be at my workstation at the end of July, so I can take a look. Unfortunately, I couldn't do it before
It is so great to hear from you !
That will be more than good enough ! Many thanks !
Last edited by ComingNine (2025-07-02 14:15:00)
Offline
mpv wrote:...
To avoid unnecessary function call we export a variable what contains pointer to a C++ function from our wrapper - see synsm.h line 10 for example as such:extern "C" { JS_PUBLIC_API(bool) (*SM_Initialize)(void) = &JS_Init;
SM_Initialize is a pointer to a function.
...Could you help to suggest how to build your wrapper SynSM.sln ?
When I open the solution in Visual Studio 2015, there are many errors that are related to includes. For example, "jspubtd.h" cannot resolve "#include "mozilla/Assertions.h"". In the file system, "Assertions.h" is under "mozilla-esr52\mfbt\Assertions.h" not "mozilla"... This seems to be a rather basic problem, since the instructions to build SpiderMonkey itself works, but I am not familiar with C++ or SpiderMonkey. Could you suggest what one needs to do to proceed ? Many thanks !
It seems that one can build SynSM.sln under windows following your how-to : D
One just needs to pay attention to some minor issues.
For example, when one follows the build SM52 how-to, put --disable-shared-js to the configure command line.
The js_static.lib is required for SynSM.sln.
Furthermore, during the mozbuild process, the include files required by SynSM.sln will be put under the i686-mingw/dist.
Offline
I can resolve an error "Class methods in record types must be static" - it's not a problem.
Problem is about E1030 Invalid compiler directive: 'external'
SpiderMonkey itself is a C++, so we need to export a C++ function as a cdecl.
To avoid unnecessary function call we export a variable what contains pointer to a C++ function from our wrapper - see synsm.h line 10 for example as such:extern "C" { JS_PUBLIC_API(bool) (*SM_Initialize)(void) = &JS_Init;
SM_Initialize is a pointer to a function.
And when import it in the SpiderMonkey.pas using
type TJS_Initialize = function : Boolean; cdecl; var JS_Init: TJS_Initialize external SpiderMonkeyLib name 'SM_Initialize';
I don't know how to do such in Delphi.
It seems that using an explicit SafeLoadLibrary followed by GetProcAddress, one can compile SpiderMonkey.pas in Delphi.
......
SM52Lib := SafeLoadLibrary(SpiderMonkeyLib);
Result := SM52Lib <> INVALID_MODULEHANDLE_VALUE;
if Result then
begin
JS_Init := TJS_Initialize(GetProcAddress(SM52Lib, 'SM_Initialize')^);
JS_ShutDown := TJS_ShutDown(GetProcAddress(SM52Lib, 'SM_ShutDown')^);
.....
The original SpiderMonkey.pas is https://snips.sh/f/C8cKlLp-nw, the modified SpiderMonkey.pas using an explicit SafeLoadLibrary followed by GetProcAddress is https://snips.sh/f/5MQRzLzUmg.
I made a simple test and it seems to work fine.
Could you help to review and test and consider to incorporate ? : D Many thanks !
Offline
Pages: 1