StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, Pack:=1) 中pack的理解

简介: <p><structlayout charset:="CharSet.Ansi," pack:="1)"> _ <br>Private Structure WAVE_EX <br>....</structlayout></p> <p>....    </p> <p>End Structure</p> <p>StructLayout(LayoutKind.Sequential,

_
Private Structure WAVE_EX
....

....   

End Structure

StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi )时取到 Marshal.SizeOf的结构会比实际大些,加入我上面的结构实际是46,那么他会是48个。
把pack 改为2就,那么就不会出现这种情况,但是结构里如果有byte这样的成员的话,应该实际3个字节,但是返回4个。
所以,系统默认的pack应该是4

 

上次碰到没有记日志,这次又折磨了我一会。 所以写个日志记一下。

如果有其他见解不妨告诉小弟。 多谢。

目录
相关文章
|
3天前
|
C语言 计算机视觉
opencv 编译objects.a(vs_version.rc.obj)‘ is incompatible with i386:x86-64 output
opencv 编译objects.a(vs_version.rc.obj)‘ is incompatible with i386:x86-64 output
15 0
|
9月前
|
XML JSON 人工智能
Error while extracting response for type [class xxx] and content type application/xml;charset=UTF-8
Error while extracting response for type [class xxx] and content type application/xml;charset=UTF-8
533 0
|
6月前
poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]
104 0
|
6月前
vue-demi@0.13.11: The engine “node“ is incompatible with this module. Expected version “>=12“. Got “
vue-demi@0.13.11: The engine “node“ is incompatible with this module. Expected version “>=12“. Got “
|
7月前
|
JSON 数据格式
Content type ‘multipart/form-data;boundary=------57031299820747271;charset=UTF-8‘ not supported的解决方案
Content type ‘multipart/form-data;boundary=------57031299820747271;charset=UTF-8‘ not supported的解决方案
66 0
|
9月前
|
JavaScript
ESLint Parsing error: control-character-in-input-stream vue/no-parsing-error
ESLint Parsing error: control-character-in-input-stream vue/no-parsing-error
96 0
|
11月前
|
Java 测试技术
body-parser:unsupported content encoding 错误
最近遇到了一个奇怪的问题,关于body-parser报错,我本地调用没问题,使用测试工具没问题,这种方案都没问题,就和我对接的程序调用有问题,于是开始了面向百度编程,查到了两种解决方案:
412 0
body-parser:unsupported content encoding 错误
|
应用服务中间件 nginx Windows
1113: No mapping for the Unicode character exists in the target multi-byte code page
1113: No mapping for the Unicode character exists in the target multi-byte code page
220 0
1113: No mapping for the Unicode character exists in the target multi-byte code page
|
Java
java实战小结-Controller报错:Content type ‘multipart/form-data;boundary=----WebKitFormBoundaryxxxx not supp
java实战小结-Controller报错:Content type ‘multipart/form-data;boundary=----WebKitFormBoundaryxxxx not supp
311 0
|
存储 缓存 应用服务中间件
解决问题:net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content)
问题 今天遇到一个问题,Web 播放器在播放对象存储服务中的某个视频文件时,总是不断的报错 206(Partial Content),具体的信息如下: net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content) 造成的结果就是视频播放失败。 播放器报错截图如下:
1317 0
解决问题:net::ERR_CONTENT_LENGTH_MISMATCH 206 (Partial Content)