3
votes

I am having trouble installing DWSScript component. I am using Delphi XE2 and when I try to compile the dwsLibRuntime.dpk I get an error ( Array type required ). I am using the latest DWScript source pulled from the project's svn repo.

What am I doing wrong?

 toStr:=TStringListCracker(sl).FList[i].FString; //produces error
 System.MonitorExit(sl);
2
@DavidHeffernan i mentioned that i am using delphi xe 2 ;) what can i do in this case ?opc0de
yep i have the last version ...opc0de
Are you sure you are compiling with XE2? I can see that the implementation of TStringList has changed (certainly between 2010 and XE2) in a way that would explain that error.David Heffernan
As a complete aside, does anyone know why this code feels the need to poke around with the private implementation details of TStringList?David Heffernan
@David: it's a speed optimization, it removes a complex call, a range check, an UStrAsg and accompanying bus lock from a critical section, along with an implicit exception frame in UnifyAssignString (used to guard the return value of the Get) and reduce register pressure in UnifyAssignString. Speedup is a few percent points in single-threaded situations up to 20-30% in some heavily multi-threaded scenarios. Just look at the code in the CPU view between the cracker-hack and the "toStr:=sl[i]" variant.Eric Grange

2 Answers

10
votes

You're not using the latest version, the monitor isn't used anymore (due to contention bugs in the RTL implementation), the second line should read as "sl.FLock.Leave;". You're likely on a pre-Delphi XE2 version, as the Monitor was dropped in february 2011.

http://code.google.com/p/dwscript/source/browse/trunk/Source/dwsUtils.pas#475

Make sure you're on the head/trunk, or Delphi isn't pointed to a different directory than the one updated by your SVN client.

1
votes

First of all make sure you downloaded the newest version from the main source, because DWScript 2.3 preview 1 is now available.

Then you must notice on this page that everyday you have changes on DWScript, so check where is the error (in which unit), then go to the source code page to take the most recent units.

Personally, it happened to me, and after I fixed some changes, it worked fine.