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ָʾ±àÒëÆ÷½«´úÂë±àÒë³ÉλÖöÀÁ¢µÄ´úÂ룬һ°ãÐèÒªÒÔ³ÌÐòÎļþ
Ïà¹ØÎĵµ£º
1 Scilab ÏÖÔÚÓÉ Scilab
лáά»¤µÄ¿ª·ÅÔ´´úÂëµÄ¿Æѧ¼ÆËãÈí¼þ¡£Ëü¾ßÓоØÕóÔËËã¡¢ÊýÖµÔËËã¡¢ÐźŴ¦Àí¡¢³ÌÐòÉè¼ÆµÈ¹¦ÄÜ£¬Ä¿Ç°Òѱ»¹ã·ºÓ¦ÓÃÓÚ½ÌÓý¡¢¿ÆÑк͹¤Òµ¡£Äã¿ÉÒÔÓÃËüÀ´Ìæ´úÊշѵÄmatlab¡£http://www.scilab.org/
2 Stellarium
ÊÇÒ»¿îÐÇÏó¹Û²âÄ£ÄâÈí¼þ¡£Ä¿Ç°È«ÇòÓÐÐí¶àÌìÎÄ°®ºÃÕߺͽÌÊÚÌìÎÄѧµÄ½ÌʦÃÇÔÚÊ¹Ó ......
Íê³É±¾ÎÄ£¬Ê¹ÓÃÁËÁ½¸ö¹¤¾ß
1. strace
2. google code search
.
----
swap·ÖÇøÓÐÒ»¸ö´óСΪPAGE_SIZEµÄÒ³Ã棬³ÆΪsignatureÒ³£¬ÉÏÃæ¼Ç¼swap·ÖÇøµÄ»ù±¾ÐÅÏ¢¡£
static struct swap_header_v1 {
char bootbits[1024]; /* Space for disklabel etc. */
unsigned int version;
......
Qt
for Embedded Linux Architecture
http://doc.qt.nokia.com/4.6/qt-embedded-architecture.html
Õë¶ÔǶÈëʽLINUX²Ù×÷ϵͳµÄQTµÄ¼Ü¹¹
¹«Ë¾½«ÔËÐÐÔÚǶÈëʽLINUXÉ豸£¨Ç¶ÈëʽÉ豸£»¸ÃÉ豸ÉÏÔËÐеIJÙ×÷ϵͳÊÇLINUX£©ÉϵÄQT×öÁËһЩ¶¨ÖƺÍÐ޸ģ¬Ê¹Æä¸üÊʺÏǶÈëʽÉ豸ÉϵÄLINUXϵͳÉÏÔËÐС£ÒÔϽ«ÕâÑùÕë¶ÔLINUXǶÈëʽÉè± ......
×î½üÒ»Ö±Ïë×°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 ......