最近搞项目遇到的记录下留个档
1、Linux下没有Ansistring变量类型,只能全局使用 string ,需要自己处理好 Ansi转Unicode的问题
2、Linux 64位下的LongWord是8个字节的,坑挺大原因未知,不过官方文档中提过
Description
Platform-dependent unsigned integer type.
LongWord represents a subset of the natural numbers. LongWord size and range depend on the target platform:
- On 32-bit platforms and 64-bit Windows platforms, LongWord is a 4-byte unsigned integer with the range
[0 .. 4294967295]
(0
through232-1
).
-
- Note: 32-bit platforms include 32-bit Windows, 32-bit macOS, 32-bit iOS, and Android.
- On 64-bit POSIX platforms (iOS and Linux), LongWord is an 8-byte unsigned integer with the range
[0 .. 18446744073709551615]
(0
through264-1
).
这里使用Cardinal替代即可
3、Linux下TStringStream使用里面的值需为宽字节才能使用 DataString输出,如果要使用窄字节则要在创建类的时候申明编码
TStringStream.Create('',TEncoding.ANSI);
后面如果遇到其他问题再追加