我如何使用C库汇编? [英] How do I use C libraries in assembler?

查看:117
本文介绍了我如何使用C库汇编?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何编写汇编文本编辑器。但是现代操作系统要求的C库,特别是对自己的视窗系统。我发现这个页面,这对我帮助很大。

I want to know how to write a text editor in assembler. But modern operating systems require C libraries, particularly for their windowing systems. I found this page, which has helped me a lot.

但我不知道是否有细节我应该知道。我知道足够汇编程序将使用用GTK +在Linux的Windows开发,但我希望能够理解我要送一个函数为它是一个有效的输入,因此,它会更容易使用所有的C库。对于C和x86汇编之间的接口,我知道什么可以从这个页面教训,并没有别的。

But I wonder if there are details I should know. I know enough assembler to write programs that will use windows in Linux using GTK+, but I want to be able to understand what I have to send to a function for it to be a valid input, so that it will be easier to make use of all C libraries. For interfacing between C and x86 assembler, I know what can be learned from this page, and little else.

推荐答案

其中最有启发性的方式来学习如何从汇编程序调用C是:

One of the most instructive ways to learn how to call C from assembler is to:


  1. 编写调用感兴趣的C函数C程序

  2. 编译它,并在大会上市看( GCC -S

  1. Write a C program that calls the C function of interest
  2. Compile it, and look at the assembly listing (gcc -S)

这个方法可以很容易通过与已经知道的东西的工作开始进行试验。你可以改变C源代码,看看如何生成的code的变化,你可以用产生的code启动并修改它自己。

This approach makes it easy to experiment by starting with something that is already known to work. You can change the C source and see how the generated code changes, and you can start with the generated code and modify it yourself.

这篇关于我如何使用C库汇编?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆