Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linux ¶¯Ì¬Á´½Ó¿â¼ÓÔØ

Linux ¶¯Ì¬Á´½Ó
Linux ÖеÄÓ¦ÓóÌÐòÒÔÒÔÏÂÁ½ÖÖ·½Ê½Ö®Ò»Á´½Óµ½Íⲿº¯Êý£ºÒªÃ´ÔÚ¹¹½¨Ê±Ó뾲̬¿â£¨ lib*.a £© ¾²Ì¬µØÁ´½Ó£¬²¢ÇÒ½«¿â´úÂë°üº¬ÔÚ¸ÃÓ¦ÓóÌÐòµÄ¿ÉÖ´ÐÐÎļþÀҪôÔÚÔËÐÐʱÓë¹²Ïí¿â£¨ lib*.so £© ¶¯Ì¬µØÁ´½Ó¡£Í¨¹ý¶¯Ì¬Á´½Ó×°ÈëÆ÷£¬½«¶¯Ì¬¿âÓ³Éä½øÓ¦ÓóÌÐòµÄ¿ÉÖ´ÐÐÄÚ´æÖС£ÔÚÆô¶¯Ó¦ÓóÌÐò֮ǰ£¬¶¯Ì¬Á´½Ó×°ÈëÆ÷½«ËùÐèµÄ¹²ÏíÄ¿±ê¿âÓ³Éäµ½Ó¦ÓóÌÐòµÄÄڴ棬»òÕßʹÓÃϵͳ¹²ÏíµÄÄ¿±ê²¢ÎªÓ¦ÓóÌÐò½âÎöËùÐèµÄÍⲿÒýÓá£ÏÖÔÚÓ¦ÓóÌÐò¾Í¿ÉÒÔÔËÐÐÁË¡£
×÷ΪʾÀý£¬ÏÂÃæÓÐÒ»¸öÑÝʾ Linux ÖжԶ¯Ì¬Á´½Ó¿âµÄȱʡʹÓõÄС³ÌÐò£º
main()
{
printf("Hello world
");
}
µ±Ê¹Óà gcc ±àÒë hello.c ʱ£¬¾Í´´½¨ÁËÒ»¸öÃûΪ a.out µÄ¿ÉÖ´ÐÐÎļþ¡£Í¨¹ýʹÓà Linux ÃüÁî ldd a.out £¨¸ÃÃüÁî´òÓ¡³ö¹²Ïí¿âµÄÏ໥ÒÀÀµÐÔ£©£¬¿ÉÒÔ¿´³öËùÐèµÄ¹²Ïí¿âÊÇ£º
libc.so.6 => /lib/libc.so.6 (0x4001d000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
ʹÓÃÏàͬµÄ¶¯Ì¬Á´½Ó×°ÈëÆ÷ÔÚÓ¦ÓóÌÐòÔËÐÐÖ®ºó½« dll Ó³Éä½øÓ¦ÓóÌÐòµÄÄڴ档ͨ¹ýʹÓà Linux ¶¯Ì¬×°ÈëÆ÷Àý³Ì£¬Ó¦ÓóÌÐò¿ØÖÆ×°ÈëÄÄÒ»¸ö¶¯Ì¬¿âÒÔ¼°µ÷ÓÿâÖеÄÄÄÒ»¸öº¯Êý£¬ÒÔÖ´ÐÐ×°ÈëºÍÁ´½ÓÒÔ¼°·µ»ØËùÐèÈë¿ÚµãµÄµØÖ·¡£
»ØÒ³Ê×
Linux dll º¯Êý
Linux Ìṩ 4 ¸ö¿âº¯Êý£¨ dlopen , dlerror , dlsym ºÍ dlclose £©£¬Ò»¸ö include Îļþ£¨ dlfcn.h £©ÒÔ¼°Á½¸ö¹²Ïí¿â£¨¾²Ì¬¿â libdl.a ºÍ¶¯Ì¬¿â libdl.so £©£¬ÒÔÖ§³Ö¶¯Ì¬Á´½Ó×°ÈëÆ÷¡£ÕâЩ¿âº¯ÊýÊÇ:
dlopen ½«¹²ÏíÄ¿±êÎļþ´ò¿ª²¢ÇÒÓ³Éäµ½ÄÚ´æÖУ¬²¢ÇÒ·µ»Ø¾ä±ú
dlsym·µ»ØÒ»¸öÖ¸Ïò±»ÇëÇóÈë¿ÚµãµÄÖ¸Õë
dlerror ·µ»Ø NULL »òÕßÒ»¸öÖ¸ÏòÃèÊö×î½ü´íÎóµÄ ASCII ×Ö·û´®µÄÖ¸Õë
dlclose¹Ø±Õ¾ä±ú²¢ÇÒÈ¡Ïû¹²ÏíÄ¿±êÎļþµÄÓ³Éä
¶¯Ì¬Á´½Ó×°ÈëÆ÷Àý³Ì dlopen ÐèÒªÔÚÎļþϵͳÖвéÕÒ¹²ÏíÄ¿±êÎļþÒÔ´ò¿ªÎļþ²¢´´½¨¾ä±ú¡£ÓÐ 4 ÖÖ·½Ê½ÓÃÒÔÖ¸¶¨ÎļþµÄλÖãº
dlopen call Öеľø¶ÔÎļþ·¾¶
ÔÚ LD_LIBRARY_PATH »·¾³±äÁ¿ÖÐÖ¸¶¨µÄĿ¼ÖÐ
ÔÚ /etc/ld.so.cache ÖÐÖ¸¶¨µÄ¿âÁбíÖ®ÖÐ
ÏÈÔÚ /usr/lib Ö®ÖУ¬È»ºóÔÚ /lib Ö®ÖÐ
»ØÒ³Ê×
dll ʾÀý£ºÐ¡µÄ C ³ÌÐòºÍ dlTest
¶¯Ì¬Á´½Ó×°ÈëÆ÷ʾÀý³ÌÐòÊÇÒ»¸öСµÄ C ³ÌÐò£¬¸Ã³ÌÐò±»Éè¼ÆÓÃÀ´Á·Ï° dl Àý³Ì¡£¸Ã³ÌÐò»ùÓÚÿ¸öÈ˶¼±àд¹ýµÄÒ»¸ö C ³ÌÐò£¬Ëü½«“Hello World”´òÓ¡µ½¿ØÖÆ̨ÉÏ¡£×î³õ´òÓ¡µÄÏûÏ¢ÊÇ“HeLlO WoRlD”¡£¸Ã²âÊÔ³ÌÐòÁ´½Óµ½ÔٴδòÓ¡¸ÃÏûÏ¢µÄÁ½¸öº¯ÊýÉÏ£ºµÚÒ»´Î¶¼Óôóд×Ö·û£¬µÚ¶þ´Î¶¼Ó


Ïà¹ØÎĵµ£º

Linuxϱà³Ì£¬¼¼ÊõÎĵµ£¬error code²éѯ·½·¨

ÓùßÁËWindowsƽ̨¿ª·¢¹¤¾ßµÄÈË£¬×ªµ½Linuxƽ̨ÉϿ϶¨ÓÐÒ»¸öÊÊÓ¦µÄ¹ý³Ì¡£
WindowsÏÂÃæÖ±½ÓʹÓÃVS20....µÈµÈ£¬ÅäºÏMSDNÎĵµ£¬¿ª·¢²éѯÇáËÉ×ÔÈç¡£
¶øLinuxƽ̨£¬ÓÉÓÚÖÖÀà·±¶àûÓÐÏñMSDNÕâÑùÈ«ÃæµÄ¼¼ÊõÎĵµ£¬¶ÔÓÚ¼¼Êõ×ÊÁϵIJéѯ¾ÍÒªÒÀ¿¿
[root@localhost]#MAN [º¯ÊýÃû]
µÄ·½Ê½À´²éѯ¡£´ó²¿·ÖµÄC++º¯Êýʱ¿ÉÒÔ²éѯµ½µÃ£¬µ«ÊÇ ......

linux select Òì²½ÁÄÌì³ÌÐò£¬±È½ÏºÃ

ʲôÊÇÒ첽ͨѶ£¿
¾ÍÊÇͨѶÈÎÒâÒ»·½¿ÉÒÔÈÎÒâ·¢ËÍÏûÏ¢£¬ÓÐÏûÏ¢À´µ½Ê±»áÊÕµ½ÏµÍ³Ìáʾȥ½ÓÊÕÏûÏ¢¡£
ÕâÀïÒªÓõ½selectº¯Êý¡£Ê¹Óò½ÖèÈçÏ£º
1¡¢ÉèÖÃÒ»¸ö¼¯ºÏ±äÁ¿£¬ÓÃÀ´´æ·ÅËùÓÐÒªÅжϵľä±ú£¨file descriptors£º¼´ÎÒÃǽ¨Á¢µÄÿ¸ösocket¡¢ÓÃopen´ò¿ªµÄÿ¸öÎļþµÈ£©
2¡¢°ÑÐèÒªÅжϵľä±ú¼ÓÈëµ½¼¯ºÏÀï
3¡¢ÉèÖÃÅжÏʱ¼ä
4¡¢¿ª ......

linux ÍøÂç±à³Ì ·þÎñÆ÷Ä£ÐÍ

 Ñ§Ï°¹ý¡¶Èí¼þ¹¤³Ì¡·°É.Èí¼þ¹¤³Ì¿ÉÊÇÿһ¸ö³ÌÐòÔ±"±ØÐÞ"µÄ¿Î³Ì°¡.Èç¹ûÄãûÓÐѧϰ¹ý, ½¨ÒéÄãÈ¥¿´Ò»¿´. ÔÚÕâÒ»ÕÂÀïÃæ,ÎÒÃÇÒ»ÆðÀ´´ÓÈí¼þ¹¤³ÌµÄ½Ç¶ÈѧϰÍøÂç±à³ÌµÄ˼Ïë.ÔÚÎÒÃÇд³ÌÐò֮ǰ, ÎÒÃǶ¼Ó¦¸Ã´ÓÈí¼þ¹¤³ÌµÄ½Ç¶È¹æ»®ºÃÎÒÃǵÄÈí¼þ,ÕâÑùÎÒÃÇ¿ª·¢Èí¼þµÄЧÂʲŻá¸ß. ÔÚÍøÂç³ÌÐòÀïÃæ,Ò»°ãµÄÀ´Ëµ¶¼ÊÇÐí ......

LINUX 0.11 ·ÖÎö¼¯½õ

    1.bootsect.s       
               ±¾ÎĵÄÄ¿µÄ£¬ÔÚ½«linux kernelµÄboot²¿·Ý×öÒ»¸ö½éÉÜ£¬ÒòΪ±ÊÕß¾õµÃºÜÉÙÓÐÕâÑùµÄ
¡¡¡¡ÎÄÕÂÀ´½éÉÜÒ»¸ö²Ù×÷ϵͳ×î×ʼµÄÒ»²½----°Ñkernel±¾ÉíÔØ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ