¹ØÓÚ extern "C"
µ±Õâ¸öÊÀ½ç»¹Ö»ÓÐCµÄʱºò£¬ÊDz»ÐèÒªextern "C"µÄ¡£
µ«ÊÇ£¬µ±C++³öÏÖÖ®ºó£¬ÓÐʱºò£¬ÎÒÃǾÍÐèÒªextern "C"ÁË¡£
ÄǾ¿¾¹ÊÇÔÚʲôÑùµÄÇé¿öÏ£¬ÎÒÃÇÐèÒªÓÃextern "C"ÄØ£¿
ÓÐÈË˵£¬ÊÇΪÁËCÄܹ»µ÷ÓÃC++£¬ÓÐÈË˵ÊÇΪÁËÔÚC++ÖÐÄܵ÷ÓÃCµÄ¿âº¯Êý¡£ÊDz»ÊÇ°ÑÄãŪºýÍ¿ÁË£¿
ÏÈ˵˵extern "C"ÊÇɶ×÷Óðɡ£
extern "C" ÊǸæËßC++±àÒëÆ÷£¬Õâ¸öº¯ÊýÊÇÍêÈ«¼æÈÝCµÄ£¬²»°üº¬C++ÓжøCÖÐûÓеÄÌØÐԵġ£²¢ÇÒ¸æËß±àÒëÆ÷£¬ÔÚÉú³ÉÄ¿±êÎļþµÄʱºò£¬Ê¹ÓÃCµÄ·½Ê½Éú³Éº¯ÊýÃû¡£
ÉÏÃæÕâ¾ä»°ÓÐÁ½¸öÖص㣬
µÚÒ»ÊÇ extern "C" Ö»ÓÐ C++±àÒëÆ÷Èϵã¬C±àÒëÆ÷ÊDz»ÈÏʶµÄ¡£
µÚ¶þÊÇ ÓÃCµÄ·½Ê½Éú³Éº¯ÊýÃû¡£Ê²Ã´½Ð "ÓÃCµÄ·½Ê½Éú³Éº¯ÊýÃû"£¿ C++±àÒëÆ÷ºÍC±àÒëÆ÷Éú³Éº¯ÊýÃûµÄ·½Ê½ÊDz»Í¬µÄ¡£ÒòΪC++ÒªÖ§³Öº¯ÊýÖØÔØ£¬ËùÒÔC++±àÒëÆ÷ÔÚÉú³Éº¯ÊýÃûµÄʱºò»á°Ñº¯Êý²ÎÊýµÄÀàÐͼÓÔÚº¯ÊýÃûÖС£¶øC±àÒëÆ÷¾Í±È½Ï¼òµ¥£¬Ö±½ÓÔÚº¯ÊýÃû×ÖÇ°¼ÓÒ»¸öÏ»®Ï߸㶨¡£
±ÈÈç void foo( int x ); ÕâÑùµÄº¯Êý
C±àÒëÆ÷±àÒë³öÀ´ÔÚ·ûºÅ¿âÖеÄÃû×ÖÊÇ_foo£¬¶øC++±àÒëÆ÷±àÒë³öÀ´ÔÚ·ûºÅ¿âÖеÄÃû×Ö¿ÉÄÜÊÇ _foo_int ÕâÑùµÄ¡£
ÄÇôʹÓà extern "C" ÓÐʲôÒâÒåÄØ£¿
ÎÒ¾õµÃ ”ΪÁËC++ÖÐÄܵ÷ÓÃCµÄ¿âº¯Êý“ ÕâÑùµÄ˵·¨ÊÇÕýÈ·µÄ¡£
Ϊʲô£¿
¿¼ÂÇÏÂÃæµÄÇé¿ö£¬ÄãÓÐÒ»¸öCʵÏֵĿ⣬²¢ÓÃC±àÒëÆ÷±àÒëÉú³É¿âÎļþ¡£
¼ÙÉèÕâ¸ö¿âÀïÓÐÒ»¸öº¯ÊýΪ void foo( int );
ÔÚC++µÄij¸öÀàÖУ¬ÄãÒªÓÃÕâ¸öfooº¯Êý£¬ÄãÔÚC++Ô´ÎļþÖÐÓÃ
extern void foo( int );
ÒýÈë¡£
ÕâÑùÔÚÁ´½ÓµÄʱºò³ö´íÁË¡£
ÒòΪC++±àÒëÆ÷ÔÚ±àÒëC++Ô´ÎļþµÄʱºò£¬ÈÏΪvoid foo( int ); ÔÚ·ûºÅ±íÖÐÓ¦¸ÃÊÇ
_foo_int Õâ¸öÑù×ӵġ£¶øÔÚÁ´½ÓµÄʱºòÕÒ²»µ½_foo_int£¬Ö»ÓÐ_foo¡£ËùÒÔÁ´½Ó³ö´íÁË¡£
Ôõô½â¾öÄØ£¿
extern void foo( int );
¸Ä³É
extern "C" void foo( int );
¾ÍÐÐÀ²¡£
Èç¹ûÊÇÖ±½Óinclude CµÄÍ·ÎļþµÄ£¬ÄÇ¿ÉÒÔÕâÑù
extern "C" {
#include "HeaderOfC.h"
}
ÕâÑùC++±àÒëÆ÷¾ÍÖªµÀ£¬Õâ¸öfooÊÇCµÄº¯Êý£¬Éú³ÉÃû×ÖµÄʱºò²»ÐèÒª´ø²ÎÊý¡£ÕâÑùÁ´½ÓµÄʱºò¾ÍûÎÊÌâÀ²¡£
ÄÇôÔÚ½ñÌ죬ÎÒÃÇдһ¸öCµÄ¿âµÄʱºò£¬µ±È»´æÔÚÎÒÃǵĿⱻC++µÄ³ÌÐòËùʹÓõĿÉÄÜÐÔ¡£
ÎÒÃDz»Ï£ÍûÔÚC++µÄÔ´ÂëÖÐÒýÓÃÎÒÃǵÄÍ·ÎļþµÄʱºò»¹Òª
extern "C" {
#include "yourlib.h"
}
ÕâôÂé·³¡£
ËùÒÔÎÒÃÇÔÚдCµÄ¿âµÄÍ·ÎļþµÄʱºòÖ÷¶¯µÄ¼ÓÉÏÁË extern "C"¡£
µ«ÕâÀïÓÐÒ»¸öÎÊÌ⣬ÒòΪC±àÒëÆ÷²»ÈÏʶextern "C"°¡£¬ËùÒÔ¾ÍÓÐÁË
ºê __cplusplus
¶ÔÓÚC±àÒëÆ÷£¬Ã»Óж¨ÒåÕâ¸öºê£¬¶øC++±àÒëÆ÷¶¨ÒåÁËÕâ¸ö
Ïà¹ØÎĵµ£º
B/S ÊÇ Brower/Server ¾ÍÊÇÓÃä¯ÀÀÆ÷(ÈçIE)ΪӦÓóÌÐò¿Í»§¶Ë²Ù×÷·þÎñÆ÷¡£ÕâÑùÓÃä¯ÀÀÆ÷À´²Ù×÷¼òµ¥Ò×Ó㬵«ÊǶÔÊäÈëûÓкܺõÄÑéÖ¤¡£Â߼ʵÏÖ²»¶à¡£±¾µØÖ»ÊÇÓÃÓÚ»ñÈ¡Êý¾ÝÈ»ºó´ó²¿·ÖÑéÖ¤ÐèÒªÌá½»·þÎñÆ÷À´Íê³É¡£
C/S ÊÇClient/Server ¿Í»§¶ËÈí¼þÔòÊÇÒ»¸öÓµÓкܶàÂß¼ÑéÖ¤µÄÈí¼þ£¬±¾µØÑéÖ¤³É¹¦ºó²ÅÌá½»·þÎñÆ÷¡£
ÎÒÕÒµ½µÄ¸üÏêϸР......
ÉÏһƪÀïµÄLAMEÏîÄ¿ÒѾչʾÁËpythonÈçºÎÓëCÓïÑÔ½»»¥£¬µ«³ÌÐòÈÔ²»¹»ÀíÏ룬ÔÚpythonÕâÒ»¶Ë½ö½öÊÇ´«µÝÔ´ÎļþºÍÄ¿±êÎļþµÄ·¾¶£¬ÔÙµ÷ÓÃCÄ£¿éµÄencode·½·¨À´½øÐбàÂ룬µ«ÎÊÌâÔÚÓÚÄãÎÞ·¨¿ØÖÆencodeº¯Êý£¬±ÈÈçÄãÏë±àÂëµÄÔ´ÎļþÈç¹û²»ÊÇÔʼÊý¾Ý£¬¶øÊÇwavÎļþ»òÕßÆäËû¸ñʽÄØ£¿¶ÔÓÚÕâ¸öÎÊÌ⣬ÓÐÁ½ÖÖ·½·¨¿ÉÒÔÑ¡Ôñ£¬Ò»ÖÖÄ£·ÂÇ°ÃæµÄCÄ£ ......
Ò»¡¢³ÌÐòÕæÚÐ
1.³ÌÐò¾ÍÊÇ“°áÊý”
¶¯×÷£º¶ÁÈ¡——¼¼Êõ——д³ö£¨ÊäÈë——´¦Àí——Êä³ö£©
Êý¾Ý½á¹¹¾ö¶¨Êý¾ÝÈçºÎ×éÖ¯£¬°á¶¯ÆðÀ´Ð§Âʽϸß
Ëã·¨ÓïÑÔ¾ ......
¿ªÊ¼—ÔËÐЗgpedit.msc£¬´ò¿ª×é²ßÂÔ´°¿Ú—Óû§ÅäÖÃϵē¹ÜÀíÄ£°å”—WINDOWS×é¼þ£¬Ë«»÷´ò¿ªWindows×ÊÔ´¹ÜÀíÆ÷£¬È»ºóË«»÷“·ÀÖ¹´ÓÎҵĵçÄÔ·ÃÎÊÇý¶¯Æ÷”£¬´ò¿ª“ÊôÐÔ”´°¿Ú£¬Ñ¡Ôñ“ÒÑÆôÓÔ£¬È»ºóÑ¡Ôñ“½öÏÞÖÆÇý¶¯Æ÷C”£¨Äã¿ÉÒÔ°ÑÄã²»ÏëÈñðÈË´ò¿ªµ ......
×öµ½×¨Òµ£¬Ó¦¸ÃÊÇÿ¸öÖ°Òµ³ÌÐòÔ±Ó¦¸ÃÒªÇó×Ô¼º×öµ½µÄ¡£
ÈÃÎÒÃÇ¿´¿´lua
ÊÇ
ÔõôдͷÎļþµÄ¡£
1.License Agreement
License
Agreement
Ó¦¸Ã¼ÓÔÚÿ¸öÍ·ÎļþµÄ¶¥²¿¡£
Lua Sample:
/*
** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $
** Lua - An ......