2006年10月3日 汇编和C中生成Lib文件

  2006年10月3日 星期3 天气晴   Last Modify: Feb 2, 2007
==================================================================================
 遇到了一个问题,就是汇编数组的存储方式的问题。见45.asm中的section3中的注释。尚未解决此问题,明日继续研究。
 另外就是为了研究45.asm中的问题有帮助,提前试验了51.asm的库测试程序。在此之前我重新编译了Irivine32.asm,获得了自己生成的Lib文件,生成的参考文献见下面的收录的英文文章。其实说白了也很简单,就是使用bin中的Lib命令把一个obj文件生成库文件Lib就行了。事实证明我的这种方法是可行的,但是SmallWin.inc还是有一堆错误……索性我把Smallwin.inc从Irvine32.inc中注释掉了,一样可以通过库的测试程序。
 在库的测试程序中,出现了一个问题,就是一开始的定义颜色的时候遇到了麻烦,颜色不听使唤了……
 ;set text color to Black text on White background:
 mov eax,black + (white * 16) ;颜色显示错乱,由于使用了二进制的颜色值,改为16进制后正常……
 call SetTextColor
 
 其中颜色常量是在Irivine32.inc中定义的,他使用的是2进制。改为16进制后正常。其中的*16指的是将该值左移4位。不知道是不是这里遇到了问题,我明天对寄存器做一个转储,看一看具体是什么原因。
How to Create your own MASM Import Libraries
by Iczelion
This short essay is about the mechanics of creating import libraries for use with MASM. I assume you already know something about import libraries, ie. you know what an import library is and so on. I will focus on the technique used to generate your own custom MASM import libraries.
MASM Import Library Format
MASM and Visual C++ can use the same import libraries which is very handy. Microsoft import libraries use a variation of COFF file format which is different from the OMF format used by TASM. That is the reason TASM cannot use MASM's import libs and vice versa. I won't go into detail about the details of Microsoft import library format. Suffice to say that every Microsoft import lib contains information about functions in some DLLs. That information includes the function names and the overall size of parameters passed to functions. If you examine kernel32.lib with a hex editor, you will find entries with this format:
_ExitProcess@4
_CreateProcessA@40
The function names are "decorated" with a leading underscore. The number following @ is the overall size of parameters of that function, in bytes. ExitProcess takes onl
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值