C调用汇编函数

  11.asm:  
   
  .386  
  .model   flat   ,   stdcall  
   
  .code  
  PUBLIC   foo  
   
  foo   proc   a   :   DWORD   ,   b   :   DWORD  
  mov   eax   ,   a  
  add   eax   ,   b  
  ret  
  foo   endp  
   
  end  
   
  22.cpp  
   
  #pragma   warning(   disable   :   4786   )  
  #include   <iostream>  
  using   namespace   std;  
  #define   for   if(0);   else   for  
   
  extern   "C"   int   __stdcall   foo(   int   a   ,   int   b   );  
   
  int   main()  
  {  
  cout   <<   foo(   1   ,   2   )   <<   endl;  
  cout   <<   foo(   100   ,   200   )   <<   endl;  
  return   0;  
  }  
   
  cl   /c   /Zi   /GX   22.cpp  
  ml   /c   /Zi   11.cpp  
  link   /OUT:test.exe   11.obj   22.obj  
   
  masm32   6.14   +   VC6   通过.  

你可能感兴趣的:(C调用汇编函数)