c++µ÷ÓÃcʱ»Øµ÷º¯ÊýµÄ´¦Àí
ÔÚc++µ÷ÓÃc³ÌÐòʱ£¬»Øµ÷º¯ÊýÊDz»ÄÜÖ±½ÓʹÓõģ¬ÒÔc++µ÷ÓÃcµÄGtkº¯ÊýΪÀý£¬ ±ÈÈ磬ÔÚg_idle_add (init, NULL);
Õâ¾ä»°ÖУ¬Ò»µ©idle¾Í»áµ÷Óú¯Êýinit(), Õâ¸öinit()»¹»á¶ÔÀàµÄ³ÉÔ±±äÁ¿½øÐд¦Àí¡£
Õâʱ£¬¼ÙÈç°Ñinit()¼òµ¥µØ¶¨ÒåΪÀàµÄÆÕͨ³ÉÔ±º¯Êý¾Í»á³öÏÖÀàÐͲ»Æ¥ÅäµÄ´íÎó£¬ÒòΪg_idle_add()ÒªÇóËüµÄµÚÒ»¸ö²ÎÊý
ÊǸöÆÕͨµÄº¯ÊýÖ¸Õ룬¶øÏÖÔÚÈ´»á±»±àÒëΪGtkScreen::init()º¯ÊýÖ¸Õ룬(¼Ù¶¨ÎÒҪдµÄÀà½Ð×öGtkScreen)¡£
½â¾ö°ì·¨¾ÍÊÇ:
1. ÔÚGtkScreenµÄÍ·ÎļþÖн«º¯Êýinit()ÉùÃ÷ΪstaticµÄ¡£
2. ÔÚÀàµÄʵÏÖÎļþ(GtkScreen.cpp)ÖÐËùÓеĺ¯ÊýÖ®ÍⶨÒåÒ»¸ö¾²Ì¬µÄÖ¸ÏòÀàµÄÖ¸Õë: static GtkScreen* pobject;
3. ÔÚ¹¹Ô캯ÊýÖжÔpobject¸³Öµ: pobjct = this; £¨Êµ¼ÊÉϲ»±ØÒ»¶¨ÔÚ¹¹Ô캯ÊýÖУ¬Ö»ÒªÊDZȵ÷ÓÃÓï¾äÔçÖ´Ðеĵط½¾ÍÐУ©
4. ÔÚÒªµ÷Óõĺ¯Êý(init)ÖÐ, ËùÓÐÀàµÄ³ÉÔ±±äÁ¿Ç°Ã涼¼ÓÉÏpobject->
¾ÍÐÐÀ²¡£
ͬʱҪעÒ⣬ÔÚc++ÖÐinclude cµÄ¿âÎļþ, include Óï¾äµÄÇ°ÃæÒª¼ÓÉÏ
#ifdef __cplusplus
extern "C" {
#endif
ºóÃæÒª¼ÓÉÏ
#ifdef __cplusplus
}
#endif
Ïà¹ØÎĵµ£º
Author: Scurffybear Date: 2009.09.08
×î½üÔÚÕÐÐÂÈË£¬ÏÂÃæÊÇÒ»µÀCµÄÃæÊÔÌ⣬ÃæÊÔµÄÓ¡¶ÈÈËÖУ¬Ã»ÓÐÒ»¸öÈË×ö¶Ô£¬ÎÒ´Ö¿´ÁËÒ»ÏÂÌ⣬ÔÚûÓп´´ð°¸Ç°£¬ÎÒ×Ô¼ºÒ²×ö´íÁË£¬àÅ£¬Êǵģ¬Ã»É¶²»ºÃÒâ˼µÄ£¬ÎÒ¾õµÃÕâ¸öÌâÄ¿ºÜÈÝÒ×ʹÈ˲úÉúÎó½â£¬ÓÖ»òÕßÔñ£ÃÓÐÉîºñ¹¦µ×µÄÈËÄܶã¹ýÕâÒ»¸öÕÏÑÛ·¨£¿
ÒÔÏÂÊÇÌâÄ¿£¬
main()
{
char * ......
ΪʲôÐèҪʹÓÃextern "C"ÄØ£¿C++Ö®¸¸ÔÚÉè¼ÆC++֮ʱ£¬¿¼Âǵ½µ±Ê±ÒѾ´æÔÚÁË´óÁ¿µÄC´úÂ룬ΪÁËÖ§³ÖÔÀ´µÄC´úÂëºÍÒѾдºÃC¿â£¬ÐèÒªÔÚC++Öо¡¿ÉÄܵÄÖ§³ÖC£¬¶øextern "C"¾ÍÊÇÆäÖеÄÒ»¸ö²ßÂÔ¡£
¡¡¡¡ÊÔÏëÕâÑùµÄÇé¿ö:Ò»¸ö¿âÎļþÒѾÓÃCдºÃÁ˶øÇÒÔËÐеúÜÁ¼ºÃ£¬Õâ¸öʱºòÎÒÃÇÐèҪʹÓÃÕâ¸ö¿âÎļþ£ ......
ºê
È«´óд, Èç¹û±ØÒª, ÓÃÁ¬×Ö·ûÁ¬½Óµ¥´Ê
#define SIZE_LIMIT 1024
#define CONFIG_DEBUG 1
#define PRODUCT_ID 0x1123
ö¾Ù
µ¥´ÊÊ××Öĸ´óд, ²»ÓÃÁ¬×Ö·û
enum {
KeyNumLock,
KeyShift,
Key1,
KayA
} Key;
......
<script>
a=62;
function encode() {
var code = document.getElementById('code').value;
code = code.replace(/[\r\n]+/g, '');
code = code.replace(/'/g, "\\'
");
var tmp = code.match(/\b(\w+)\b/g);
tmp.sort();
var dict = [];
var i, t = '';
for(var i=0; i<tmp.length ......
int main()
{
printf(&unix["\021%six\012\0"], (unix)["have"] + "fun" - 0x60);
}
gcc -S±àÒë³É»ã±à´úÂëÈçÏÂ:
.file "test.c"
.section .rodata
.LC0:
&nbs ......