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

C³ÌÐòʹÓò»Í¬º¯Êýµ÷ÓÃÔ¼¶¨µ÷Óûã±à×Ó¹ý³Ì

ÈçתÔØ£¬Çë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/zhangyang0402/archive/2010/05/01/5549266.aspx
 
¿ª·¢¹¤¾ß£ºVC ++ 6.0  MASM32
 
Ò»¡¢__cdeclµ÷Ó÷½Ê½
 
1£®  ÔÚVCÖÐн¨Win32 Console Application, TestASM
 
2£®  н¨test.c
#include<stdio.h>
extern void swap(int *px, int *py);
int main(void)
{
       int a=1, b=2;
       printf("before swaping, a=%d, b=%d\n", a, b);
       swap(&a, &b);
       printf("after  swaping, a=%d, b=%d\n", a, b);
    return 0;
}
 
3£®  ʹÓÃUltraEdit±à¼­»ã±à³ÌÐòswap.asm
.386
.MODEL FLAT, C
OPTION CASEMAP:NONE
.CODE
  swap PROC a:DWORD, b:DWORD
    PUSH ESI
    PUSH EDI
      MOV ESI, [EBP+8]
     MOV EAX, [ESI]    ;²ÎÊý1µÄÖµ->EAX
      MOV EDI, [EBP+12]
      XCHG EAX, [EDI]
      MOV [ESI], EAX
      POP EDI
      POP ESI
      RET
  swap ENDP
END
 
4£®  ½«swap.asmÌí¼Óµ½TestASM¹¤³ÌÖÐ
VC->Project->Add to project->Files, ÎļþÀàÐÍÑ¡Ôñ“ËùÓÐÎļþ”£¬Ñ¡Öлã±àÔ´Îļþswap.asm²¢Ìí¼Óµ½¹¤³Ì
»òÖ±½Ó±àÒëswap.asm£¬½«Éú³ÉµÄswap.obj¿½±´µ½¹¤³ÌĿ¼ÏÂ
5£®  ÔÚVCÖÐÉèÖûã±à³ÌÐò±àÒëÑ¡Ïî
ÔÚVCµÄFileViewÖУ¬ÓÒ»÷swap.asm->Settings, Çл»µ½“Custom Build”Ñ¡Ï£¬
ÔÚ“Command”ÖÐÊäÈ룺ml /c /coff  $(InputName).asm£¬
“Output”ÖÐÊäÈë £º$(InputName).obj
 
6£®  ±àÒëÁ´½ÓÖ´ÐÐ
Ë«»÷test.c->Compile£¬ Éú³Étest.obj
Ë«»÷swap.asm->Compile£¬ Éú³Éswap.obj
È»ºóBuild£¬ Éú³ÉTestASM.exe
×îºóÖ´ÐÐ
½á¹ûÈçÏÂ:
before swaping, a=1, b=2
after  swaping, a=2, b=1
Press any key to continue
 
¶þ¡¢__stdcallµ÷Ó÷½Ê½
1.CÔ´³ÌÐò
#include<stdio.h>
extern


Ïà¹ØÎĵµ£º

extern cµÄ×÷ÓÃ

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

extern "C"

CºÍC++»¥Ïàµ÷Óú¯Êýʱ£¬Ê¹ÓÃextern "C"¡£
Ô­Òò£º
C²»Ö§³Öº¯ÊýÖØÔØ£¬¶øC++Ö§³Öº¯ÊýÖØÔØ¡£º¯Êý±»C++±àÒëºó»áÃû×ÖÓëCÓïÑÔ²»Í¬¡£¼ÙÉèijº¯ÊýÔ­ÐÍΪfoo(ing x, int y)£¬±»C++±àÒëºóÃû×ÖΪ_foo_int_int£¬¶øC±àÒëÆ÷±àÒëºóÃû×ÖΪ_foo¡£ ......

C/C++ ³£¼ûÎóÇø


C/C++ ³£¼ûÎóÇø
 
1. C++ËäÈ»Ö÷ÒªÊÇÒÔCµÄ»ù´¡·¢Õ¹ÆðÀ´µÄÒ»ÃÅÐÂÓïÑÔ£¬µ«Ëý²»ÊÇCµÄÌæ´úÆ·£¬²»ÊÇCµÄÉý¼¶£¬C++ºÍCÊÇÐֵܹØϵ¡£Ã»ÓÐË­±ÈË­ÏȽøµÄ˵·¨£¬¸üÖØÒªµÄÒ»µãÊÇCºÍC++¸÷×Եıê׼ίԱ»áÊǶÀÁ¢µÄ£¬×îеÄC++±ê×¼ÊÇC++98£¬×îеÄC±ê×¼ÊÇC99¡£Òò´ËҲûÓÐÏÈѧCÔÙ˵C++µÄ˵·¨£¬Ò²²»ÔÙ£¨×¢ÒâÕâ¸ö"²»ÔÙ"£©ÓÐC++Óï·¨ ......

C/C++Êý×éÃûÓëÖ¸ÕëÇø±ðÉîÈë̽Ë÷

Ö¸ÕëÊÇC/C++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚCÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º"Êý×éÃû¾ÍÊÇÖ¸Õë"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×ÅC/C++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí±ß»¹Ò»Ö±³äÂúÕ ......

GNU C Library——×îÈ«µÄ£Ãº¯Êý˵Ã÷

Ç°Ììдһ¸öС³ÌÐò, ͻȻ·¢ÏÖÆäʵżµÄCѧµÄ²»ÔõôÑù°¡£¬ºÃ¶àº¯Êý¶¼²»¼ÇµÃ£¬ÔÚÍøÉÏËѵ½µÄ¶¼ÊÇЩÂÒÆß°ËÔãµÄ£¬Ã»ÓÐÔ­ÐÍ£¬ÓÃÆðÀ´²»·ÅÐÄ£¬ÓãÅÎÄËÑ£¬Ëѵ½ÕæÕýµÄBible——
The GNU C Library Manual
ÕâÀïÃæÌ«È«ÁË£¬Ö»ÊÇÓÐÒ»µã²»Ì«ºÃ£¬£ÅÎĵģ¬¶ÁÆðÀ´ÓеãÂý£¬¸Ð¾õÓеãÀË·Ñʱ¼ä
ÓãÃдÁ˶ÎС³ÌÐò°ÑÒ»¸öÎå±ÊÂëÎı¾Îĵµ×ª ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ