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

Linux ¹²Ïí¿â±à³Ì[ת]

Linux ¹²Ïí¿â±à³Ì
×÷ÕߣºÖÕÄÏ   <li.zhongnan@hotmail.com
>
1¡¢½éÉÜ
¶¯Ì¬¿âÊdzÌÐòÉè¼Æ³£Óõļ¼Êõ£¬²ÉÓö¯Ì¬¿â¿ÉÒÔÓÐЧµÄ¼õÉÙ³ÌÐò´óС£¬½ÚÊ¡¿Õ¼ä£¬Ìá¸ßЧÂÊ£¬Ôö¼Ó³ÌÐòµÄ¿ÉÀ©Õ¹ÐÔ£¬±ãÓÚÄ£¿é»¯¹ÜÀí¡£ÔÚWindowsºÍ
Linux²Ù×÷ϵͳÖж¼Óж¯Ì¬¿âµÄ¸ÅÄî¡£Windows½«Æä³ÆΪ¶¯Ì¬Á´½Ó¿â£¨Dynamic Link
Library£¬DLL£©£¬ÆäÎļþÀ©Õ¹ÃûΪ.dll£¬Linux³ÆÆäΪ¹²Ïí¿â¼¼Êõ£¨Shared Library£©£¬ÏàÓ¦µÄ¹²Ïí¿âÎļþÀ©Õ¹ÃûΪ.so¡£
¹ÊÃû˼Ò壬¶¯Ì¬¿âÔÚ³ÌÐòÔËÐеÄʱºò±»¶¯Ì¬Á´½Ó¡£µ«ÊÇÔÚ¾ßÌåʹÓö¯Ì¬¿âµÄʱºòÈ´ÓÐÁ½ÖÖ²»Í¬µÄ·½Ê½£ºÒþʽÁ´½ÓºÍÏÔʽÁ´½Ó¡£ÒþʽÁ´½ÓÔÚ±àÒë/Á´½Ó½×¶ÎÍê
³É£¬ÓɱàÒëϵͳ¸ù¾Ý¶¯Ì¬¿âµÄÍ·ÎļþºÍ¿âÎļþ½øÐбàÒëºÍÁ´½Ó£¬´Ó¶øÈ·¶¨´ýµ÷Óõĺ¯ÊýÔ­Ðκ͵ØÖ·¡£ÏÔʽÁ´½ÓÔòÊÇÀûÓÃAPIº¯ÊýʵÏÖ¼ÓÔغÍжÔع²Ïí¿â£¬»ñÈ¡´øµ÷
Óú¯ÊýµØÖ·£¬»ñÈ¡´íÎóÐÅÏ¢µÈ¹¦ÄÜ¡£
2¡¢ÒþʽÁ´½Ó¾ÙÀý
£¨1£©¶¯Ì¬¿âÎļþ´úÂ룺dl_func.c
#include <stdio.h>
extern char name[];
int add(int a, int b)
{
        printf("calling add\n");
        printf("Hello, %s!\n", name);
        return a + b;
}
¸ÃÎļþÖеÄadd()º¯Êý¼ÆËãÁ½¸öÕûÊýÖ®ºÍ£¬²¢ÇÒ´òÓ¡Íⲿ±äÁ¿µÄÖµ£¬¸ÃÍⲿ±äÁ¿Óɵ÷Óù²Ïí¿âµÄÊÂÀý³ÌÐò¶¨Òå¡£
£¨2£©¿Í»§¶ËÊÂÀý´úÂ룺dl_demo1.c
#include <stdio.h>
#include <dlfcn.h>
int add(int a, int b);
char name[100];
int main(int argc, char *argv[]) {
        int a = 10, b = 20;
        int c = 0;
        strcpy(name, "NHN XDBMS");
        c = add(a, b);
        printf("%d + %d = %d\n", a, b, c);
        return 0;
}
¸ÃÊÂÀý³ÌÐòµ÷Óù²Ïí¿âµÄÖеÄadd()º¯Êý¼ÆËãÁ½ÊýÖ®ºó²¢´òÓ¡£¬Í¬Ê±ÔÚÊÂÀý³ÌÐòÖУ¬¸ø±äÁ¿name¸³Öµ£¬ÒÔ±ãÔÚadd()º¯ÊýÖдòÓ¡¡£
£¨3£©±àÒëÓëÔËÐÐ
±àÒë¹²Ïí¿â£º
gcc -o libdl_func.so -fPIC -rdynamic -shared dl_func.c
Ñ¡Ïî-fPICָʾ±àÒëÆ÷½«´úÂë±àÒë³ÉλÖöÀÁ¢µÄ´úÂ룬һ°ãÐèÒªÒÔ³ÌÐòÎļþ


Ïà¹ØÎĵµ£º

2.6°æLinuxÄں˽ṹÌåÖ¸¶¨³õʼ»¯

ÔÚÔĶÁGNU/LinuxÄں˴úÂëʱ£¬ÎÒÃÇ»áÓöµ½Ò»ÖÖÌØÊâµÄ½á¹¹³õʼ»¯·½Ê½¡£¸Ã·½Ê½ÊÇijЩC½Ì²Ä£¨ÈçÌ·¶þ°æ¡¢K&R¶þ°æ£©ÖÐûÓнéÉܹýµÄ¡£ÕâÖÖ·½Ê½³ÆΪָ¶¨³õʼ»¯£¨designated initializer£©¡£ÏÂÃæÎÒÃÇ¿´Ò»¸öÀý×Ó£¬Linux-2.6.x/drivers/usb/storage/usb.cÖÐÓÐÕâÑùÒ»¸ö½á¹¹Ìå³õʼ»¯ÏîÄ¿£º
static struct usb_driver usb_storage_dri ......

²é¿´window¡¢LinuxºÍAix»úCPUλÊýºÍ²Ù×÷ϵͳ°æ±¾

Ìâ¼Ç£º½ñÌì¿´µ½Ò»Æª¹ØÓڲ鿴CPUºÍ²Ù×÷ϵͳÐÅÏ¢µÄÎÄÕ£¬×ª¹ýÀ´ºÍ´ó¼Ò·ÖÏíһϣ¬O(∩_∩)O£¡
Á˽âcpu¼Ü¹¹   http://blog.csdn.net/wyzxg/archive/2009/12/17/5027738.aspx
Ç°Á½Ìì¼òµ¥×ܽáÁËcpu¼Ü¹¹£¬½ñÌì×ܽáϲ鿴¸÷ÖÖosϵͳµÄλÊýºÍcpuÓ²¼þÖ§³ÖµÄλÊý£¬ÒòΪÕâЩÎÒÃÇÔÚÈÕ³£¹¤×÷ÖÐÒª¾­³£Óõ½µÄ£¬×÷ΪÈÕ³£µÄ ......

ת LinuxÉ豸Çý¶¯³ÌÐòÖ®¶ÁÊé±Ê¼Ç

LinuxÉ豸Çý¶¯³ÌÐòÖ®¶ÁÊé±Ê¼Ç£¨Ò»£©
                   ——µÚÈýÕÂ×Ö·ûÉ豸Çý¶¯³ÌÐò
¡ð¡¢ËµÃ÷
±Ê¼ÇÊÊÓÃÓÚLinuxµÄ2.6.10ÒÔºóµÄÄںˡ£
±Ê¼ÇÒÔLinux Device Driver3ÌṩµÄscull³ÌÐò(scullĿ¼ÖеÄmain.cºÍscull.h) ......

Linux shell±à³Ì


±¾ÎÄÍøÖ·:http://bbs.bitscn.com/72875 ¸´ÖÆ ¡¾×ª×Ôbbs.bitsCN.com¡¿
1. Linux ½Å±¾±àд»ù´¡
1.1 Óï·¨»ù±¾½éÉÜ
1.1.1 ¿ªÍ·
       ³ÌÐò±ØÐëÒÔÏÂÃæµÄÐпªÊ¼£¨±ØÐë·ÅÔÚÎļþµÄµÚÒ»ÐУ©£º
       #!/bin/sh
¡¡   ·ûºÅ#!ÓÃÀ´¸æËßϵͳËüºóÃæµÄ² ......

redhat linux AS4.0(U5ÆóÒµ°æ4.0£©ÏÂÔصØÖ·£¨5ÕÅÅÌ£©

×î½üÒ»Ö±Ïë×°linux  U5,һֱûÕÒµ½£¬½ñÌìÕÒµ½ÁË£¬·ÖÏí¸ø´ó¼Ò£¡£¡£¡
ftp://openware.byr.edu.cn/pub/os-images/Redhat/RHEL4u5/i386/RHEL4-U5-i386-AS-disc1.iso
 
ftp://openware.byr.edu.cn/pub/os-images/Redhat/RHEL4u5/i386/RHEL4-U5-i386-AS-disc2.iso
 
ftp://openware.byr.edu.cn/pub/os-images ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ