== 정적 라이브러리(.a) ==
 * 사용하기
   {{{
ar rcs my_library.a [http://imfzs.crc-deff.com/183400.htm f]ile1.o [http://www.angelfire.com/bc3/annwhite1755/index.htm f]ile2.o
gcc -o test1 test.o -lmy_library -L./
   }}}
== 공유 라이브러리(.so) ==
 * 만들기
   {{{
gcc -fPIC -c [http://www.angelfire.com/psy/ninawhite1342/index.htm a].c 
gcc -fPIC -c [http://uk.geocities.com/steeve_tropez_282/index.htm b].c
gcc -shared -soname,libmystuff.so.1 -o libmystuff.so.1.0.1 a.o b.o -lc
   }}}
 * 사용방법
   {{{
gcc -o [http://qvde.crc-deff.com/8.htm t]est1 test.o -lmy_library
   }}}
  *UNIX ( Linux, Solaris)
    * LD_LIBRARY_PATH
  *HU-UX
    * SHLIB_PATH
  *AIX
    * LIBPATH
 * so debug
   {{{
$ export LD_DEBUG=files
$ test.exe
# 라이브러리를 다룰때 파일과 라이브러리의 동작을 보여주고,
# 어떤 의존성이 발견되었고, 어떤 SOs(sonames)가 어떤 순서로
# 로드되었는지 말해준다.
# LD_DEBUG를 bindings로 설정하는 것은 심볼제한에 대한 정보를
# 보여주고, libs에 설정하는은 것은 라이브러리 탐색경로에 대해서 보여주고,
# version으로 설정하는 것은 버전 의존성을 보여준다.
$ export LD_DEBUG=help <-- 도움말 출력
   }}}
== 참조 ==
 * 관련 링크
  * http://kldp.org/HOWTO/html/Program-Library-HOWTO/index.html

댓글 없음:
댓글 쓰기