Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÓÃGCCÊä³ö´øCÔ´´úÂë×¢Ê͵Ļã±àÁбíÎļþ

ÎÒÃǶ¼ÖªµÀgccµÄ-S¿ª¹Ø¿ÉÒÔÓÃÀ´Éú³É»ã±à´úÂ룬
µ«ÓÐʱºò£¬µ¥Óлã±àÎļþÊDz»¹»µÄ£¬ÎÒÃÇÏ£ÍûµÄÊǽ«CÓïÑÔ³ÌÐòµÄÔ´´úÂëºÍ»ã±àÓïÑÔÎı¾½»´íÔÚÒ»Æð²é¿´£¬
ÕâÊÇLISTING¹¦ÄÜ£¬ÔÚgccÖв¢Ã»ÓÐרÃŵÄFAQ˵Ã÷£¬
ÇøÇøÔÚÍøÉϲéÁ˺ܶà×ÊÁϲÅÖªµÀÔõôʵÏÖ£¬ËùÒÔÌش˼ÇÏ¡£
gcc -c -g -Wa,-adlhn ee.c >  ee.anno.s
ÓÉ´ËÉú³ÉµÄee.anno.s¼´ÊÇee.c¶ÔÓ¦µÄCÓë»ã±à»ìÅŵÄÁбí

ÓÖÈçC³ÌÐò
/* EE */
#include<stdio.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<windows.h>
int main(int argc, char **argv)
{
  char * p = "TO STDOUT";
  int ic   = (int)GetStdHandle(STD_OUTPUT_HANDLE);
  printf("%d\n", ic);
  WriteFile(ic, p, strlen(p), &ic, NULL);
  return 0;
}
¿ÉÒÔÉú³É
   1              
.file
"ee.c"
   4              
.text
   5              
Ltext0:
 4222              
.section .rdata,"dr"
 4223              
LC0:
 4224 0000 544F2053
.ascii "TO STDOUT\0"
 4224      54444F55 
 4224      5400
 4225              
LC1:
 4226 000a 25640A00
.ascii "%d\12\0"
 4227 000e 0000    
.text
 4231              
.globl _main
 4233              
_main:
   1:ee.c          **** /* EE */
   2:ee.c          **** #include<stdio.h>
   3:ee.c          **** #include<stdio.h>
   4:ee.c          **** #include<string.h>
   5:ee.c   &nbs


Ïà¹ØÎĵµ£º

cºê¶¨ÒåµÄ¼¼ÇÉ×ܽá


1,·ÀÖ¹Ò»¸öÍ·Îļþ±»Öظ´°üº¬
#ifndef COMDEF_H
#define COMDEF_H
//Í·ÎļþÄÚÈÝ
#endif
2,ÖØж¨ÒåһЩÀàÐÍ,·ÀÖ¹ÓÉÓÚ¸÷ÖÖƽ̨ºÍ±àÒëÆ÷µÄ²»Í¬,¶ø²úÉúµÄÀàÐÍ×Ö½ÚÊý²îÒì,·½±ãÒÆÖ²¡£
typedef unsigned char      boolean;     /* Boolean value type. */
typedef ......

C++ÖÐextern ¡°C¡±º¬ÒåÉî²ã̽Ë÷

1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......

ÈçºÎÔÚC++Öе÷ÓÃCµÄ´úÂë

ÒÔÇ°Ôø¾­×ܽá¹ýһƪ(http://www.cppblog.com/franksunny/archive/2007/11/29/37510.html
)£¬¹ØÓÚÔÚ
C
ÖÐÈçºÎµ÷ÓÃ
C++
µÄ´úÂ룬µ±Ê±²¢Î´×öÍêÈ«µÄÕ¹¿ª£¬Ö»ÊǼòµ¥µÄ×öÁËϵ÷ÊÔ£¬×î½ü¿´µ½Ò»¸öÌâÄ¿ÒªÇóʵÏÖ
C
ºÍ
C++
ÖдúÂëµÄ»¥Ïàµ÷Óã¬Æä½á¹ûËäÈ»¶¼ÊÇͨ¹ý
extern “C”
À´ÊµÏÖ
£¬µ«ÊǾßÌ廹ÊÇÓÐЩ²î±ðµÄ¡ ......

¡¶±à³ÌÖéçá¡·ÎÊÌâµÄCʵÏÖ——2£ºÏòÁ¿Ðýת

 #include <stdio.h>
#include <stdlib.h>
#define SIZE 17
void reverse(int start, int end);
int data[SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
int main(void)
{
int i = 5;
reverse(0, i - 1);
reverse(i, SIZE-1);
reverse(0, SIZE-1);
return ......

cÁ´±íµÄ2ÖÖÐÎʽ

c±ä³ÉµÄ¶ÔÏó´ó¶àÊǹ²ÏíÄÚ´æÖÐÉêÇ룬±È½ÏÉÙÓÃmallocÖ±½ÓÀ´ÉêÇ룬ËùÒÔÁ´±íÉè¼ÆÒ»°ãÊÇÏÂÃæ2Öнṹ£º
¶ÔÏó --> ¶ÔÏó --> ¶ÔÏó
¶ÔÏó -->Á´±í¶ÔÏó-->¶ÔÏó -->Á´±í¶ÔÏó
£¨1£©¶ÔÓÚµÚÒ»ÖÖ£¬Á´±íÖ±½Ó¹ØÁªµ½¶ÔÏó±¾Éí£¬ËùÒÔÈç¹ûÒ»¸ö¶ÔÏóÔÚÏûÍöʱ£¬Ã»Óм°Ê±ÇåÀíµôÁ´±í¹Øϵ£¬Ôò»áµ¼ÖÂÁ´±íµôÁ´¡£
£¨2£©Á´±í¶ÔÏó±¾ÉíÊÇÒ» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ