You are not logged in.
Pages: 1
I recently started using mormot.core.base in a bigger project of mine.
There are a couple of types declared in mormot.core.base which are problematic:
unaligned = Double;
unaligned is a special Typecast in Freepascal that is used to give the compiler a hint for unaligned memory accesses. This is important because ARMv7 and older will issue a system trap if memory is access without that modifier, making your code extermely slow. Sadly FPC does not give it's internal Typecast preference if mormot.core.base is used, so any code that uses the "real" unaligned typecast no longer compiles. You should rename this to remove this clash.
https://www.freepascal.org/docs-html/ref/refse86.html
TByteArray / PByteArray and TWordArray / PWordArray are already declared in SysUtils. If you project has a unit that uses SysUtils and another that uses mormot.core.base, your code will not compile as the compiler sees the clashing type definitions as incompatible types. As mormot.core.base uses sysutils anyway, these duplicate declarations should be removed.
Cheers,
scamp
Offline
Please check the lines before and after:
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
/// unaligned() will be defined and useful only on FPC ARM/Aarch64 plaforms
unaligned = Double;
{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
So this unaligned is defined only when alignment is not required. So for ARMv7, FPC_REQUIRES_PROPER_ALIGNMENT is defined, and regular unaligned() is compiled.
About TByteArray / PByteArray and TWordArray / PWordArray, the idea is to define mormot.core.base after sysutils in the uses clause.
And if you really need to access the sysutils version, then explicitly write sysutils.TByteArray. And to be honnest, they are very rarely used in normal code, because they are just pointers to an unrealistic huge array.
Offline
Pages: 1