LinuxϱàÒ붯̬¿â£¬¾²Ì¬¿â£¬ÒÔ¼°µ÷ÓÃ
so_test.h£º
#include
#include
void test_a();
void test_b();
void test_c();
test_a.c£º
#include "so_test.h"
void test_a()
{
printf("this is in test_a...\n");
}
test_b.c£º
#include "so_test.h"
void test_b()
{
printf("this is in test_b...\n");
}
test_a.c£º
#include "so_test.h"
void test_c()
{
printf("this is in test_c...\n");
}
½«Õ⼸¸öÎļþ±àÒë³ÉÒ»¸ö¶¯Ì¬¿â£ºlibtest.so
$ gcc test_a.c test_b.c test_c.c -fPIC -shared -o libtest.so
test.c£º
#include "so_test.h"
int main()
{
test_a();
test_b();
test_c();
return 0;
}
l ½«test.cÓ붯̬¿âlibtest.soÁ´½ÓÉú³ÉÖ´ÐÐÎļþtest£º
$ gcc test.c -L. -ltest -o test
l ²âÊÔÊÇ·ñ¶¯Ì¬Á¬½Ó£¬Èç¹ûÁгölibtest.so£¬ÄÇôӦ¸ÃÊÇÁ¬½ÓÕý³£ÁË
$ ldd test
×îÖ÷ÒªµÄÊÇGCCÃüÁîÐеÄÒ»¸öÑ¡Ïî:
-shared
¸ÃÑ¡ÏîÖ¸¶¨Éú³É¶¯Ì¬Á¬½Ó¿â£¨ÈÃÁ¬½ÓÆ÷Éú³ÉTÀàÐ͵ĵ¼³ö·ûºÅ±í£¬ÓÐʱºòÒ²Éú³ÉÈõÁ¬½ÓWÀàÐ͵ĵ¼³ö·ûºÅ£©£¬²»ÓøñêÖ¾Íⲿ³ÌÐòÎÞ·¨Á¬½Ó¡£Ï൱ÓÚÒ»¸ö¿ÉÖ´ÐÐÎļþ
l
-fPIC£º±íʾ±àÒëΪλÖöÀÁ¢µÄ´úÂ룬²»ÓôËÑ¡ÏîµÄ»°±àÒëºóµÄ´úÂëÊÇλÖÃÏà¹ØµÄËùÒÔ¶¯Ì¬ÔØÈëʱÊÇͨ¹ý´úÂ뿽±´µÄ·½Ê½À´Âú×㲻ͬ½ø³ÌµÄÐèÒª£¬¶ø²»ÄÜ´ïµ½Õæ
Õý´úÂë¶Î¹²ÏíµÄÄ¿µÄ¡£
l -L.£º±íʾҪÁ¬½ÓµÄ¿âÔÚµ±Ç°Ä¿Â¼ÖÐ
l -ltest£º±àÒëÆ÷²éÕÒ¶¯Ì¬Á¬½Ó¿âʱÓÐÒþº¬µÄÃüÃû¹æÔò£¬¼´ÔÚ¸ø³öµÄÃû×ÖÇ°Ãæ¼ÓÉÏlib£¬ºóÃæ¼ÓÉÏ.soÀ´È·¶¨¿âµÄÃû³Æ
l LD_LIBRARY_PATH£ºÕâ¸ö»·¾³±äÁ¿Ö¸Ê¾¶¯Ì¬Á¬½ÓÆ÷¿ÉÒÔ×°Ôض¯Ì¬¿âµÄ·¾¶¡£
×îºó. Êä³ö¿âµÄ·¾¶£¬»òÕß¿½±´µ½/libĿ¼ÏÂ
export LD_LIBRARY_PATH=. // ÀÏÆÅ´óÈ˸æËß°³µÄ
Ö´ÐÐ ./test
¸ã¶¨
¾²Ì¬:
ÏȱàÒë³É.o
gcc -c test_a.c test_b.c test_c.c
È»ºóÓÃarÃüÁî
ar -r libtest.a test_a.o test_b.o test_c.o
Ïà¹ØÎĵµ£º
Ò»¡¢ÒýÑÔ£º
±¾ÎĵµµÄÄÚÈݴ󲿷ÝÄÚÈݶ¼ÊÇ´ÓÍøÉÏÊÕ¼¯¶øÀ´£¬È»ºóÅäºÏһЩеĽØͼ£¨Äں˰汾£ºV2.4.19£©¡£ÔÚÿһÅäÖÃÏîºó»áÓÐÒ»¸öÑ¡ÔñÖ¸ÄϵIJ¿·Ý£¬ÓÃÀ´Ö¸µ¼´ó¼ÒÔõôÑù¸ù¾Ý×Ô¼ºµÄÇé¿öÀ´×öÏàÓ¦µÄÑ¡Ôñ£»»¹ÓÐÔÚÿһ¸ö´óÏîºÍÎĵµµÄ×îºó»áÓÐÒ»¸ö¾Ñé̸£¬ËüÊÇһЩ¸ßÊÖÃÇÔÚÓ¦¶ÔÎÊÌâºÍ´¦ÀíÌØÓÐÓ²¼þʱµÄһЩ¾Ñ飨Õâ¸ö»¹µ ......
ÔÚ±¾½Ì³ÌÖУ¬ÎÒÃǽ«¸øÄú½éÉÜ bash£¨±ê×¼µÄ Linux shell£©£¬ÎªÄúչʾÈçºÎ³ä·ÖÀûÓÃÈç ls¡¢cp ºÍ mv ÕâÑùµÄ±ê×¼ Linux ÃüÁ²¢ÏòÄú½²½â Linux µÄȨÏÞºÍËùÓÐȨģÐÍÒÔ¼°¸ü·á¸»µÄÄÚÈÝ¡£ÔÚ±¾½Ì³Ì½áÊøÖ®¼Ê£¬Äú½«¾ßÓÐ Linux »ù´¡ÖªÊ¶·½ÃæµÄÔúʵ»ù´¡£¬ÉõÖÁ»¹¿ÉÒÔ×¼±¸¿ªÊ¼Ñ§Ï°Ò»Ð©»ù±¾µÄ Linux ϵͳ¹ÜÀíÈÎÎñ·½ÃæµÄ֪ʶ¡£
Ò»¡£¹ØÓÚ±¾½ ......
http://www.ibm.com/developerworks/cn/linux/embed/diy/
DIY£º×Ô¼º¶¯ÊÖ×öÒ»¸öÃÔÄã Linux ϵͳ
ÎĵµÑ¡Ïî
<tr valign="top"><td width="8"><img alt="" height="1" width="8" src="//www.ibm.com/i/c.gif"/></td><td width=&quo ......
Ò». Æô¶¯,¹Ø»ú,µÇÈë,µÇ³öÏà¹ØÃüÁî
<login> 怬
<logout> µÇ³ö
<exit> µÇ³ö
<shutdown> ֹͣϵͳ
<halt> ֹͣϵͳ
<reboot> ÖØÆô¶¯
<poweroff> ÇжϵçÔ´
<sync> °ÑÄÚ´æÀïµÄÄÚÈÝдÈë´ÅÅÌ
<lilo> °²×°liloÆô¶¯¹ÜÀí³ÌÐò
<grub> °²×°liloÆô¶¯¹ÜÀí³ÌÐò ......
http://www.askwan.com/post/28/
haproxy+keepalived
LinuxÆóÒµ¼¯Èº
http://book.51cto.com/art/200806/76015.htm#
µÚÒ»²½:rsyncͬ²½webÊý¾Ý£¨²âÊÔͨ¹ý²¢ÇÒ×Ô¼º¼ÓÈëÁËsshµÄRSA keyÑéÖ¤£©
http://www.linuxsir.org/main/?q=node/256 rsync ·þÎñÆ÷¼ÜÉè·½·¨ v0.1b £¨ÕýÔÚÐÞ¶©ÖУ©
µÚ¶þ²½:°²×°heartbeat²¢ÇÒ¿ ......