<div dir="ltr"><div>When I used both managers, like in example, program doesnt work as expected. Should I report it as error ? For now I will stay with cwstring manager, but good to know that there is native implementation(first I need to study something about unicode and collation though) . In fpc sources I found fpwidestring used only in windows builds. <br>
<br></div><div>regards tomas<br></div><div><br></div>Example - linux i386, fpc 2.7.1 r25610<br><div><br>program fpwidestring_stringlist;<br><br>uses<br><br>// 3 possible combination of cwstring, fpwidestring<br>// 1) only cwstring - program works as expected and writes 4<br>
// 2) only fpwidestring - error, because compareunicodestring function is not implemented<br>// (current_Collation is nil in my case in fpwidestrign.CompareUnicodeString)<br>// 3) both units - program writes -1 - which si really not expected<br>
<br><br> cwstring,<br> fpwidestring,<br> classes;<br><br>var<br> m: TStringList;<br>begin<br> m := TStringList.Create;<br> try<br> m.Add('{E13ABA32-1328-4AFA-B21D-438AD054C0A5}');<br> m.Add('{019D0AA0-915E-41CA-9145-05E6FC2D967C}');<br>
m.Add('{02591FA7-202B-4D63-BEC7-636B00BA1A8C}');<br> m.Add('{23884961-80F8-4130-B60C-A5CF540A67C1}');<br> m.Add('{3B3C9C24-0E23-44ED-8466-3024DF24011F}');<br> m.Add('{398F240E-8809-4CE7-9175-983B96189526}');<br>
m.Add('{661979DB-C38D-4348-A617-59DD28D3327B}');<br> m.Add('{87AC64E0-87FF-4CA5-B81C-AD494942703D}');<br> Writeln('IndexOf {3B3C9C24-0E23-44ED-8466-3024DF24011F} is ', m.IndexOf('{3B3C9C24-0E23-44ED-8466-3024DF24011F}'));<br>
finally<br> m.Free;<br> end;<br>end.<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 7, 2013 at 9:27 AM, Michael Schnell <span dir="ltr"><<a href="mailto:mschnell@lumino.de" target="_blank">mschnell@lumino.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 10/04/2013 11:02 PM, Sven Barth wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
If you want to share Unicode- or AnsiStrings between library and application you need to use a common memory manager. For example you could use unit "cmem" as one of the first units of both programs. It will work on Unix based systems and *should* work on Windows ones as well.<br>
</blockquote>
<br></div>
BTW.:<br>
<br>
For my embedded C projects, I use different memory managers, dependent on the complexity of the project. Either a straight forward one, that just allocates blocks in a linked list or a more sophisticated one that uses different strategies for different block sizes (small: allocate equally sized blocks, medium: use a linked list within a preoccupied area, large: one area for each block.<br>
<br>
AFAIK the fpc RTL memory manager is similarly "sophisticated", no Idea what cmem does.<br>
<br>
I do know that for Delphi a third-party memory manager exists that works similar and on top oft hat allows for unifying the memory management of a program and the dlls called (which Delphi also does out of the box with dynamic packages).<br>
<br>
Can "cmem" (or some other fpc aware memory manager) also unify the memory management of a program and dlls (e.g. in order to allow for "plugins to fpc programs) ?<span class="HOEnZb"><font color="#888888"><br>
<br>
-Michael</font></span><div class="HOEnZb"><div class="h5"><br>
______________________________<u></u>_________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.<u></u>org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/<u></u>mailman/listinfo/fpc-pascal</a><br>
</div></div></blockquote></div><br></div></div>