首页 新闻 赞助 找找看

关于IL中Marshal的疑问

0
悬赏园豆:10 [已解决问题] 解决于 2009-12-20 17:54

今天看一篇文章讲述怎么在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

From Ocean的主页 From Ocean | 菜鸟二级 | 园豆:220
提问于:2009-12-19 18:20
< >
分享
最佳答案
0

就是 阵列的意思

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]

收获园豆:10
woody.wu | 老鸟四级 |园豆:3621 | 2009-12-20 10:22
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册