Inside Microsoft.NET IL Assembler中的第一个例子

每次下定决心研读《Inside Microsoft.NET IL Assembler》都因在敲完第一个例子之后不能得到预期的结果而放弃了。我遇到的问题是,不论输入的是数字,抑或是非数字,程序总是返回How rude,然后结束。这次我决定不再放弃了,我一定要找出原因,为什么作者能够正常运行,而我们这里就不行。最终让我找到了,在sscanf函数的声明中添加preservesig就能得到预期的效果,如下: 

.method public static pinvokeimpl("msvcrt.dll" cdecl) vararg int32 sscanf(string,int8*) cil managed preservesig{}

我猜想可能是作者当时使用的ILASM跟我们现在的不同了,我使用的是VS2010自带的ILASM,而作者这本书因该写于2002年前后,想来这期间ILASM有了修改也是正常的事情。抑或者作者犯了个错误,不知道了。反正加了preservesig就可以了!


希望想读这本书,而又遇见跟我同样问题的人,不要因为这个问题而止步。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Introduction Why This Book Was Written To tell the truth, I don't think I had much choice in this matter. Let me explain. With Microsoft .NET technology taking the world by storm, with more and more information professionals getting involved, large numbers of books covering various aspects of this technology have started to arrive—and none too soon. Alas, virtually all of these books are dedicated to .NET-based programming in high-level languages and rapid application development (RAD) environments. No doubt this is extremely important, and I am sure all these books will have to be reprinted to satisfy the demand. But what about the plumbing? The .NET universe, like other information technology universes, resem bles a great pyramid turned upside down and standing on its tip. The tip on which the .NET pyramid stands is the common language runtime. The runtime converts the intermediate language (IL) binary code into platform-specific (native) machine code and executes it. Resting on top of the runtime are the .NET Framework class library, the compilers, and environments such as Microsoft Visual Studio .NET. And above them begin the layers of application development, from instrumental to end-user-oriented. The pyramid quickly grows higher and wider. This book is not exactly about the common language runtime—even though it's only the tip of the .NET pyramid, the runtime is too vast a topic to be described in detail in any book of reasonable (say, luggable) size. Rather, this book focuses on the next best thing: the .NET IL Assembler. IL assembly language (ILAsm) is a low-level language, specifically designed to describe every functional feature of the common language runtime. If the runtime can do it, ILAsm must be able to express it. Unlike high-level languages, and like other assembly languages, ILAsm is platform-driven rather than concept-driven. An assembly language usually is an exact linguistic mapping of the underlying platform, which in this case is the commo

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值