<p>Am 05.01.2015 21:33 schrieb "Michael Van Ham" <<a href="mailto:michael.vanham@gmail.com">michael.vanham@gmail.com</a>>:<br>
><br>
> Hello,<br>
><br>
> The simple program below compiles and produces the expected output in 2.6.4. In 2.7.1 (3.1.1 now) an EAccessViolation is caused.<br>
><br>
> The strlower function seems to be in strings.inc and written in assembler. Unfortunately I can not decipher the assembly to research further.<br>
><br>
> ---<br>
><br>
> program teststrlowersimple;<br>
><br>
> {$mode objfpc}<br>
> {$H+}<br>
><br>
> uses<br>
> sysutils;<br>
><br>
> var<br>
> s : string;<br>
> p : pchar;<br>
><br>
> begin<br>
> s := 'UPPPERCASESTRING';<br>
> p := pchar(s);<br>
> strlower(p); // EAccessViolation: Access violation<br>
> writeln(s);<br>
> end.</p>
<p>It's because in your example s points to a constant string which since 2.7.1 resides in a non-writeable section of the executable (Delphi compatible if I remember correctly). Instead of assigning a constant try for example "Readln(s)" or use UniqueString(s) (if I remember the function name correctly) after the assignment.</p>
<p>Regards,<br>
Sven</p>