为了账号安全,请及时绑定邮箱和手机立即绑定

关于IL中Marshal的疑问

关于IL中Marshal的疑问

牛魔王的故事 2018-12-07 02:15:21
今天看一篇文章讲述怎么在net环境下使用com组件中的IL修改的代码中看到了 Marshal([+1])   这样一个东东,查了不少资料,但是仍然一无所获,请问这个东东做什么用的?其中的“+1”是指示什么?这个数字到底指向什么? 引用原文: .method public hidebysig newslot virtual abstract            instance void  MyNextLongs([in] int32 nReq,                                 // Replace this: [out] int32& rgelt,                                 // With this:                                 [out] int32[] marshal([ + 1]) rgelt,                                 [out] int32& pnFetched) runtime managed internalcall

1 回答

?
呼啦一阵风

TA贡献1802条经验 获得超6个赞

就是 阵列的意思

MICROSOFT提交给标准化组织ECMA的规范

可以参考

ECMA-334 --定义了C#编程语言的语法和语义

ECMA-335--定义了许多.NET平台的细节,统称CIL.

 

[Example:
.method int32 M1( int32 marshal(int32), bool[] marshal(bool[5]) )
Method M1 takes two arguments: an int32, and an array of 5 bools.
.method int32 M2( int32 marshal(int32), bool[] marshal(bool[+1]) )
Method M2 takes two arguments: an int32, and an array of bools: the number of elements in
that array is
given by the value of the first parameter.
.method int32 M3( int32 marshal(int32), bool[] marshal(bool[7+1]) )
Method M3 takes two arguments: an int32, and an array of bools: the number of elements in that array is
given as 7 plus the value of the first parameter. end example]

查看完整回答
反对 回复 2019-01-21

添加回答

代码语言

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号