What is the Irvine32 library and why do we use it?

老子叫甜甜 提交于 2020-01-21 15:54:12

问题


I want to know that the Irvine32 assembly language library is.

I want a definition and also why we use this library.


回答1:


I want to know that what is Irvine32 library in assembly language.

Irvine32 library is collection of helpful functions, you may check online documentation for list of them and further details.

I want a defenation and also why we use this library?

I don't know why you use it.

Usually one wants to use it to avoid writing the code providing that functionality himself. As the assembly code replicating some of the functionality may be tens or hundreds of lines of code (or even thousands for very complex functions), and having it to write every time may be cumbersome.

Also the API provided by Irvine32 functions is often simpler to use than similar API provided by OS services, so it may be often somewhat simpler to use Irvine32 instead of calling the OS services directly.

It also provides library functions that read and print integers (like WriteDec), which there's no system call for. So it's like a simplified C library printf. And ReadDec returns a value in EAX, and success/fail in FLAGS (CF), while C library scanf requires you to pass a pointer where the result will be stored1.

It's designed for beginners and simple programs, not for efficiency. For example, Irvine32 uses its own calling convention with no call-clobbered registers, so you can print stuff inside a loop without having to think of keeping your loop counter in a register that it's not going to step on.


Footnote 1: Because scanf can do multiple conversions in one call, and because C can't return both an integer and a flag as two separate return values. Returning a value in a register with success/fail in CF is something only asm calling conventions can normally use. It's not unique to Irvine32, though. Mac OS system calls do that, for example.



来源:https://stackoverflow.com/questions/54386649/what-is-the-irvine32-library-and-why-do-we-use-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!