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

Libtool´´½¨ºÍʹÓÃlinux϶¯Ì¬¿â

Îļþfun.c£¬fun.h£¬hello.c£¬hello.h£¬main.c¶¯Ì¬¿âº¯Êý¶¼ÔÚfun.cºÍhello.cÀïÃæ
----------------------------
fun.c:
int add(int a, int b)
{
 return a+b;
}
fun.h:
#ifndef _FUN_H_11
#define _FUN_H_11
int add(int a, int b);
#endif
----------------------------
hello.c:
££i nclude <stdio.h>
void output(char *ss)
{
 printf("HELLO  %s\n", ss);
}
hello.h
#ifndef HELLO_H_111
#define HELLO_H_111
void output(char *ss);
#endif
----------------------------
main.c:
££i nclude <stdio.h>
££i nclude "hello.h"
££i nclude "fun.h"
void
main()
{
 output("world");
 printf("Test Value:%d\n", add(1, 2));
}
---------------------------------
ʹÓÃlibtools´´½¨ºÍʹÓð²×°¶¯Ì¬¿â²½Öè:
(1)
libtool --mode=compile gcc -g -O -c hello.c
libtool --mode=compile gcc -g -O -c fun.c
libtool --mode=compile gcc -g -O -c main.c
#Éú³É¸÷×ÔµÄoÎļþ
(2)
libtool --mode=link gcc -g -O -o libhello.la hello.lo fun.lo -rpath /usr/local/lib -lm
#Á¬½Ó³É¶¯Ì¬¿âÎļþ
(3)
libtool --mode=link gcc -g -O -o test main.o libhello.la -lm
#Á¬½ÓÉú³É¿ÉÖ´ÐÐÎļþtest
(4)
libtool --mode=install cp libhello.la /usr/local/lib/libhello.la
libtool --mode=install install -c libhello.la /usr/local/lib/libhello.la
libtool -n --mode=finish /usr/local/lib
libtool install -c test /usr/local/bin/test
#°²×°¶¯Ì¬¿â
È»ºó¾Í¿ÉÒÔÔËÐÐ/usr/local/bin/testÁË,µ±È»Â·¾¶¿ÉÒÔÈÎÒâÉèÖÃ,ÕâÊÇÊÖ¶¯¹ý³Ì,д³ÉMakefileÎļþΪ:
OBJS = fun.o hello.o
LO_OBJS = main.lo fun.lo hello.lo
PACKAGE_VERSION = 1:1:1
LIBDIR=/usr/local/lib
all : test
install : libhello.la
 
test : libhello.la main.o
 libtool --mode=link gcc -g -O -o test main.o libhello.la -lm
libhello.la : $(OBJS)
 libtool gcc -g -O -o libhello.la $(LO_OBJS) -rpath ${LIBDIR} -lm -version-info ${PACKAGE_VERSION}
main.o : main.c fun.h hello.h
 libtool --mode=compile gcc -g -O -c main.c
fun.o : fun.c fun.h
 libtool --mode=compile gcc -g -O -c fun.c
hello.o : hello.c hello.h
 libtool --mode=comp


Ïà¹ØÎĵµ£º

LinuxÐźÅÁбí

ÔËÐÐÈçÏÂÃüÁ¿É¿´µ½LinuxÖ§³ÖµÄÐźÅÁÐ±í£º
$ kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL
5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE
9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2
13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD
18) S ......

LINUX»·¾³½ø³Ì¼äͨÐÅ

linuxÐźŻúÖÆÔ¶Ô¶±ÈÏëÏóµÄ¸´ÔÓ£¬±¾ÎÄÁ¦ÕùÓÃ×î¶ÌµÄƪ·ù£¬¶Ô¸Ã»úÖÆ×öÁËÉîÈëϸÖµķÖÎö¡£¶ÁÕß¿ÉÒÔÏȶÁÒ»ÏÂÐźÅÓ¦ÓÃʵÀý£¨ÔÚÐźţ¨Ï£©ÖУ©£¬ÕâÑù¿ÉÒÔ¶ÔÐźŷ¢ËÍÖ±µ½ÏàÓ¦µÄ´¦Àíº¯ÊýÖ´ÐÐÍê±ÏÕâÒ»¹ý³ÌÓиö´óÖµÄÓ¡Ïó¡£±¾Îľ¡Á¿¸ø³öÁ˽Ïк¯ÊýµÄÓ¦ÓÃʵÀý£¬×ÅÖØËµÃ÷ÕâЩµÄ¹¦ÄÜ¡£
Ò»¡¢Ðźż°ÐźÅÀ´Ô´
Ðźű¾ÖÊ

Ð ......

linuxÎļþÀàÐÍ

linuxÖУ¬Í¨¹ý
ls -al
ÏÔʾµÄÊôÐÔÖУ¬µÚÒ»¸ö¾Í±êÖ¾ÎļþÀàÐÍ¡£Í¨³£ÓÐһϼ¸ÖÖÇé¿ö£º
[ - ]£­£­£­£­ÆÕͨÎļþ
[ d]£­£­£­£­Ä¿Â¼
[ l ]£­£­£­£­Á¬½ÓÎļþ
[ b]£­£­£­£­¿éÉ豸
[ c ]£­£­£­£­×Ö·ûÉ豸
[ s ]£­£­£­£­Ì×½á×Ö
[ p ]£­£­£­£­¹ÜµÀ ......

[Pthread] LinuxÉϳÌÐòµ÷ÊԵĻùʯ(Ò»)

Ô­ÎĵØÖ·£ºhttp://blog.csdn.net/Javadino/archive/2008/09/06/2891413.aspx
Òý×Ó:
1.ÔÚLinuxϵͳÖУ¬½ø³Ì״̬³ýÁËÎÒÃÇËùÊìÖªµÄTASK_RUNNING£¬TASK_INTERRUPTIBLE£¬TASK_STOPPEDµÈ£¬»¹ÓÐÒ»¸öTASK_TRACED¡£Õâ±íÃ÷Õâ¸ö½ø³Ì´¦ÓÚʲô״̬£¿
2.strace¿ÉÒÔ·½±ãµÄ°ïÖúÎÒÃǼǼ½ø³ÌËùÖ´ÐеÄϵͳµ÷Óã¬ËüÊÇÈçºÎ¸ú×Ùµ½½ø³ÌÖ´ÐÐµÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ