¡¾ÀíÂÛ֪ʶƪ¡¿Linux»ìºÏ±à³Ì+log4cpp
ÓÉÓÚҪʹÓõ½log4cppµÄ¿â£¬¶ølog4cµÄ×ÊÁÏÊǷdz£µÄÉÙ£¬Ò²ÀÁµÃÈ¥Ñо¿ËüµÄÓ÷¨£¬ÓÚÊǾ;ö¶¨ÊÔÊÔ»ìºÏ±à³ÌÕßÍæÒâ¡£
Ê×ÏÈÏÈÒýÓÃÏÂC++ËüµÄfather: StroustrupµÄһƪÎÄÕ¡¶C++ Style and Technique FAQ¡·£¨http://www2.research.att.com/~bs/bs_faq2.html£©ÀïµÄһС¸öƬ¶Î£º
Just declare the C function ``extern "C"'' (in your C++ code) and call it (from your C or C++ code). For example:
// C++ code
extern "C" void f(int); // one way
extern "C" { // another way
int g(double);
double h();
};
void code(int i, double d)
{
f(i);
int ii = g(d);
double dd = h();
// ...
}
The definitions of the functions may look like this:
/* C code: */
void f(int i)
{
/* ... */
}
int g(double d)
{
/* ... */
}
double h()
{
/* ... */
}
Note that C++ type rules, not C rules, are used. So you can't call function declared ``extern "C"'' with the wrong number of argument. For example:
// C++ code
void more_code(int i, double d)
{
double dd = h(i,d); // error: unexpected arguments
// ...
}
Just declare the C++ function ``extern "C"'' (in your C++ code) and call it (from your C or C++ code). For example:
// C++ code:
extern "C" void f(int);
void f(int i)
{
// ...
}
Now f() can be used like this:
/* C code: */
void f(int);
void cc(int i)
{
f(i);
/* ... */
}
Naturally, this works only for non-member functions. If you want to call member functions (incl. virtual functions) from C, you need to provide a simple wrapper. For example:
// C++ code:
class C {
// ...
virtual double f(int);
};
extern "C" double call_C_f(C* p, int i) // wrapper function
{
return p->f(i);
}
Now C::f() can be used like this:
/* C code: */
double call_C_f(struct C* p, int i);
void ccc(struct C* p, int i)
{
double d = call_C_f(p,i);
/* ... */
}
If you want to call overloaded functions from C, you must provide wrappers with distinct names for th
Ïà¹ØÎĵµ£º
Ò»¡¢Ê²Ã´ÊÇtelnet
TelnetµÄÓ¦Óò»½ö·½±ãÁËÎÒÃǽøÐÐÔ¶³ÌµÇ¼£¬Ò²¸øhackerÃÇÌṩÁËÓÖÒ»ÖÖÈëÇÖÊֶκͺóÃÅ£¬µ«ÎÞÂÛÈçºÎ£¬ÔÚÄ㾡ÇéÏíÊÜTelnetËù´ø¸øÄãµÄ±ã½ÝµÄͬʱ£¬ÄãÊÇ·ñÕæÕýµÄÁ˽âTelnetÄØ£¿¡¡¡¡
¡¡¡¡¶þ Ô¶³ÌµÇ¼¡¡¡¡
¡¡¡¡Telnet·þÎñËäȻҲÊôÓÚ¿Í»§»ú/·þÎñÆ÷Ä£Ð͵ķþÎñ£¬µ«Ëü¸ü´óµÄÒâÒåÔ ......
1¡¢Linux »ù´¡
°²×°Linux²Ù×÷ϵͳ LinuxÎļþϵͳ Linux³£ÓÃÃüÁî LinuxÆô¶¯¹ý³ÌÏê½â ÊìϤLinux·þÎñÄܹ»¶ÀÁ¢°²×°Linux²Ù×÷ϵͳ Äܹ»ÊìÁ·Ê¹ÓÃLinuxϵͳµÄ»ù±¾ÃüÁî ÈÏʶLinuxϵͳµÄ³£Ó÷þÎñ°²×°Linux²Ù×÷ϵͳ Linux»ù±¾ÃüÁîʵ¼ù ÉèÖÃLinux»·¾³±äÁ¿ ¶¨ÖÆLinuxµÄ·þÎñ Shell ±à³Ì»ù´¡Ê¹ÓÃvi±à¼Îļþ ʹÓÃEmacs±à¼Îļþ ʹÓÃÆäËû±à ......
Ò»¡¢ÓÃvi filename´ò¿ªÎļþ£º
¶þ¡¢»ù±¾ÖªÊ¶£ºvi ¿ÉÒÔ·ÖÈýÖÖ״̬£ºÃüÁîģʽ£¨command£©¡¢²åÈëģʽ£¨insert£©ºÍÄ©ÐÐģʽ£¨last line£©
£¨1£©ÃüÁîģʽ£º´ò¿ªÎļþʱĬÈÏÊÇÃüÁîģʽ£¬¿ØÖÆÆÁÄ»¹â±êµÄÒƶ¯¡¢×Ö·û¡¢×Ö»òÕßÐеÄɾ³ý£¬Òƶ¯ &nb ......
×î½ü¹«Ë¾Òª×ölinuxǶÈëʽϵͳ£¬Ä¿Ç°Ö÷°åÊDzÉÓÃx86½á¹¹¡£ËùÒÔ¾ÍÔÚ×Ô¼ºµÄ±¾±¾ÉÏ×°ÁËÒ»¸öÐéÄâµÄºìÆì6¡£
ÒòΪÊÇÐÂÊÖ£¬¸Õ¿ªÊ¼µÄʱºòÈÏΪlinux²Ã¼ôÄѵÄÓ¦¸ÃÊÇϵͳÄں˲üô£¬¿ÉÊÇÒ»¶Îʱ¼ä·¢ÏÖ²»Êǵġ£Ïà±ÈÖ®ÏÂÄÚºËÊDZȽϼòµ¥µÄ¡£
Äں˲üôÖ÷ÒªµÄ¹¤×÷ÊÇÄãÐèҪʲô¹¦ÄܾͰѶÔÓ¦µÄÄ£¿éÑ¡ÉÏ£¬ÄѵãÖ»ÊÇÓ¢Óï²»ÈÝÒ׿´¶®£¬Òªµ½ÍøÉÏËÑË÷· ......
LinuxϵͳϵÄGcc£¨GNU C Compiler£©ÊÇGNUÍƳöµÄ¹¦ÄÜÇ¿´ó¡¢ÐÔÄÜÓÅÔ½µÄ¶àƽ̨±àÒëÆ÷£¬ÊÇGNUµÄ´ú±í×÷Æ·Ö®Ò»¡£gccÊÇ¿ÉÒÔÔÚ¶àÖÖÓ²Ìåƽ̨ÉϱàÒë³ö¿ÉÖ´ÐгÌÐòµÄ³¬¼¶±àÒëÆ÷£¬ÆäÖ´ÐÐЧÂÊÓëÒ»°ãµÄ±àÒëÆ÷Ïà±Èƽ¾ùЧÂÊÒª¸ß20%~30%¡£ Gcc±àÒëÆ÷Äܽ«C¡¢C++ÓïÑÔÔ´³ÌÐò¡¢»ã³Ìʽ»¯ÐòºÍÄ¿±ê³ÌÐò±àÒë¡¢Á¬½Ó³É¿ÉÖ´ÐÐÎļþ£¬Èç¹ûûÓиø³ö¿ÉÖ´ÐÐÎÄ ......