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.
regards tomas Example - linux i386, fpc 2.7.1 r25610 program fpwidestring_stringlist; uses // 3 possible combination of cwstring, fpwidestring // 1) only cwstring - program works as expected and writes 4 // 2) only fpwidestring - error, because compareunicodestring function is not implemented // (current_Collation is nil in my case in fpwidestrign.CompareUnicodeString) // 3) both units - program writes -1 - which si really not expected cwstring, fpwidestring, classes; var m: TStringList; begin m := TStringList.Create; try m.Add('{E13ABA32-1328-4AFA-B21D-438AD054C0A5}'); m.Add('{019D0AA0-915E-41CA-9145-05E6FC2D967C}'); m.Add('{02591FA7-202B-4D63-BEC7-636B00BA1A8C}'); m.Add('{23884961-80F8-4130-B60C-A5CF540A67C1}'); m.Add('{3B3C9C24-0E23-44ED-8466-3024DF24011F}'); m.Add('{398F240E-8809-4CE7-9175-983B96189526}'); m.Add('{661979DB-C38D-4348-A617-59DD28D3327B}'); m.Add('{87AC64E0-87FF-4CA5-B81C-AD494942703D}'); Writeln('IndexOf {3B3C9C24-0E23-44ED-8466-3024DF24011F} is ', m.IndexOf('{3B3C9C24-0E23-44ED-8466-3024DF24011F}')); finally m.Free; end; end. On Mon, Oct 7, 2013 at 9:27 AM, Michael Schnell <mschn...@lumino.de> wrote: > On 10/04/2013 11:02 PM, Sven Barth wrote: > >> >> 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. >> > > BTW.: > > 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. > > AFAIK the fpc RTL memory manager is similarly "sophisticated", no Idea > what cmem does. > > 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). > > 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) ? > > -Michael > > ______________________________**_________________ > fpc-pascal maillist - > fpc-pascal@lists.freepascal.**org<fpc-pascal@lists.freepascal.org> > http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal> >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal