C/C++º¯Êýµ÷ÓÃÔ¼¶¨Ö®¼äµÄת»»
CÓïÑԵijõѧÕß³£·¸µÄÒ»¸öʧÎóÊǵ÷ÓÃϵͳ»òµÚÈý·½APIʱÍüÁËÔÚº¯ÊýÉùÃ÷Öбê×¢WINAPIµ÷Ó÷½Ê½£¬¶ø²ËÄñC++³ÌÐòԱҲÿÿÀ§»óΪʲô³ÉÔ±º¯Êý±ØÐëָʾΪCALLBACKÔÙÌí¼Óstatic¹Ø¼ü×Ö²ÅÄÜ×÷Ϊ»Øµ÷º¯Êý¡£ÔÚx86ϵͳÖУ¬´æÔÚ¶àÖÖº¯Êýµ÷ÓÃÔ¼¶¨¡£Èç¹ûµ÷ÓÃÕßÓë±»µ÷ÓÃÕß²ÉÓò»Í¬µÄµ÷ÓÃÔ¼¶¨£¬ºÜ¿ÉÄܵ¼Ö¶ÑÕ»ÆÆ»µ¡¢·Ç·¨·ÃÎʵÈÖÂÃü´íÎó¡£
Ò²ÐíÄú»áµÃ³öÒ»¸ö½áÂÛ£¬³ý·Ç½èÖú»ã±àÖ¸Á·ñÔòµ÷ÓÃÔ¼¶¨Ö®¼äµÄת»»ÊDz»¿ÉÄܵġ£²»¹ýºÜ¶àÊÂÇ鶼²»ÊǾø¶ÔµÄ¡£ÎÒÃÇÏÈ¿´ÏÂÃæµÄÀý×Ó£º
#include
int __cdecl CDeclFunction()
{
printf("from CDecl function\n");
return 1;
}
int main()
{
printf("Begin call STDCall function\n");
typedef int(__stdcall * STDCALLFUNCTION)();
STDCALLFUNCTION pfn =(STDCALLFUNCTION)CDeclFunction;
int i=pfn();
printf("End call STDCall function\n");
return i;
}
ÕâÊÇÒ»¸ö¼òµ¥µÄº¯Êýµ÷ÓõÄÀý×Ó£¬Î¨Ò»ÌرðµÄµØ·½ÊǺ¯Êý¶¨ÒåΪ__cdecl£¬¶øµ÷ÓÃʱ²ÉÓÃ__stdcall·½Ê½¡£ÎÒÃÇ°ÑÕâ¶Î´úÂë±àÒëºóÖ´ÐС£àÀ£¬Ò»ÇÐÕý³£¡£Èç¹ûÄú²»·þÆø£¬ÔÙ¼ÓÒ»¸öforÑ»·¿´¿´J
ÎÒÃÇÔÙÀ´¿´ÁíÒ»¸ö¸üÌرðµÄÀý×Ó£º
#include
int __stdcall StdCallFunction (int i, char* pszString)
{
printf("from STDCall function\n");
printf(pszString);
return i;
}
int main()
{
printf("Begin call FastCall function\n");
typedef int(__fastcall * FASTCALLFUNCTION)(int, int, int, char*);
FASTCALLFUNCTION pfn =(FASTCALLFUNCTION)StdCallFunction;
int i=pfn(0,0,3,"test\n");
printf("End call FastCall function\n");
return i;
}
Õâ´Î²»¹âµ÷Ó÷½Ê½²»Í¬£¬Á¬²ÎÊýµÄ¸öÊý¶¼²»Ò»Ñù¡£±ðµ£ÐÄ£¬ÎÒÃDZàÒëºóÖ´ÐС£»¹ÊÇÒ»ÇÐÕý³££¡
Èç¹ûÄú¶ÔÉÏÊöÁ½¸öÀý×Ó°Ù˼²»µÃÆä½âµÄ»°£¬ÏÖÔÚ¸ÃÊǽ⿪ÃÕµ×µÄʱºòÁË¡£Õâ¸öÃÕµ×¾ÍÊǺ¯Êýµ÷ÓÃÔ¼¶¨±¾Éí¡£ÍøÉϽéÉܵ÷ÓÃÔ¼¶¨µÄ×ÊÁÏÒѾÏ൱¶àÁË£¬²»¹ý¼¸ºõ¶¼²àÖرȽϸ÷ÖÖµ÷Ó÷½Ê½µÄ²î±ð£¬¶ø±¾ÎĽ«°ÑÖصã·ÅÔÚÕâЩµ÷Ó÷½Ê½Ö®¼äµÄÁªÏµÉÏÃ棨ÕâÀïÒ²ÂÔÈ¥Öî¶àÓëÖ÷ÌâÎ޹صÄϸ½Ú£¬ÒªÏëÁ˽⺯Êýµ÷ÓÃÔ¼¶¨µÄËùÓз½Ê½£¬ÏàÓ¦µÄ»ã±à´úÂ룬ÒÔ¼°ÔÚ²ÎÊý»ò·µ»ØÖµ³¬¹ý32λµÈ¸´ÔÓÇé¿öµÄ´¦Àí·½Ê½£¬Çë²éÔı¾ÎÄÁгöµÄ²Î¿¼ÊéÄ¿£©¡£
µ÷Óú¯Êýʱ£¬ÐèÒª´«µÝ²ÎÊý£¬²¢½ÓÊÕ·µ»ØÖµ¡£¶ÔÓÚC++ ·Ç¾²Ì¬³ÉÔ±º¯Êý£¬»¹Òª¿¼ÂÇÈçºÎ´«µÝthisÖ¸Õë¡£ÕâҪô²ÉÓüĴæÆ÷£¬ÒªÃ´²ÉÓöÑÕ»¡£Èç¹û²ÉÓöÑÕ»£¬»¹Òª¿¼ÂÇÓÉ˸ºÔð»Ö¸´¶ÑÕ»µÄƽºâ¡£µ÷
Ïà¹ØÎĵµ£º
ÔÚÕâ¶ùÏÂÔØ£ºcolor-theme
:
http://download.savannah.gnu.org/releases-noredirect/color-theme/
wget http://download.savannah.gnu.org/releases-noredirect/color-theme/color-theme-6.6.0.tar.gz
tar zxf color-theme-6.6.0.tar.gz -C ~/.emacs.d
ÔÚ.emacsÖмÓÈëÏÂÁÐÓï¾ä£º
;; corlor-theme ......
֮ǰд¹ýÒ»¸öʵÏÖÁËijÖÖ¹¦ÄܵÄjava³ÌÐò£¬µ«ÓÉÓÚ½üÈÕ“¹¤×÷”ÐèÒª£¬ÓÖÐèÒªÔÚc/c++ÖÐÖØÐÂʹÓøù¦ÄÜ¡£ÎªÁ˽Úʡʱ¼ä£¬ÎÒ²ÉÈ¡ÁËÔÚc/c++Öе÷ÓÃjava³ÌÐòµÄ·½·¨£¬µ«Ö®Ç°Ã»ÓнӴ¥¹ýÀàËƵĶ«Î÷£¬µ½ÍøÉÏÒ»²é£¬¹ûÈ»ÓÐÀàËƵĶ«Î÷£¬ÐÄÖаµÏ²ing...¡£²éµ½µÄ×ÊÁÏÖÐÓм¸¸ö²»´íµÄÍøÒ³£º
&nbs ......
×öWindows³ÌÐò¿ª·¢£¬windows APIÒ»¶¨ÊÇҪѧϰµÄ¡£ËäÈ»ÏÖÔÚwindowsƽ̨ϵĿª·¢»·¾³Óкܶ࣬ҲºÜ·½±ã£¬µ«Í¨³£Ö»»áÌṩ
windows·þÎñµÄÒ»¸ö×Ó¼¯£¬ÓÐЩÌØÐÔ»¹µÃµ÷ÓÃAPI¡£
·Ö²ãÊÇÈí¼þ¿ª·¢ÖÐÒ»¸öÓÀ¾ÃµÄ½â¾ö·½°¸£¬ºÜ¶àÄÑÒÔ½â¾öµÄÎÊÌⶼ¿ÉÒÔÓöà¼ÓÒ»²ãÀ´½â¾ö¡£²Ù×÷ϵͳ¾ÍÊÇÒ»¸öºÜºÃµÄÀý×Ó¡£²Ù×÷ϵͳÔÚ
Èí¼þ¿ª·¢ÈËÔ±Óë¼ÆËã»úÓ²¼þÖ ......
ÊÕ¼¯ÁË¿´Ò»ÏÂC/C++±ê×¼¿âʹÓõÄÏà¹ØÍøÕ¾£º
GNU¹ÙÍø£º
http://www.gnu.org/
¸ÃÍøÕ¾°üº¬C/C++±ê×¼¿âµÄʹÓ÷¶Àý£¬ÖµµÃ²Î¿¼£º
http://www.cplusplus.com/
ÔÚǶÈëʽµÚÈý·½Èí¼þÒÆֲʱ£¬»áʹÓÃSTLÄ£°å¿â×÷ÏàÓ¦ÒÆÖ²£¬ÈçAndroidƽ̨JNI·â×°¼°ÒÆÖ²µÈ¡£
¸ÃÍøÕ¾½éÉÜstlportµÄʹÓã¬stlportÒѿɳɹ¦ÒÆÖ²ÖÁAndroidµÈǶÈëʽƽ̨£¬²¢Ç ......