manywaypark's Blog
개발, 검색, 함수

가끔은 자기 자신이 어디서 로딩되었는지를 알아야만 할 때가 있다.

static initialization 과정에서 함수의 주소로 알아내는 방법이 있다.

#define _GNU_SOURCE

#include <dlfcn.h>

#include <stdio.h>


__attribute__((constructor))

void on_load(void) {

  Dl_info dl_info;

  dladdr((void *)on_load, &dl_info);

  fprintf(stderr, "module %s loaded\n", dl_info.dli_fname);

}

좀더 자세한건 man 3 dladdr


refs: 

http://stackoverflow.com/questions/1681060/library-path-when-dynamically-loaded

https://cseweb.ucsd.edu/~gbournou/CSE131/the_inside_story_on_shared_libraries_and_dynamic_loading.pdf

the_inside_story_on_shared_libraries_and_dynamic_loading.pdf

happy hackin'

problem:
원본 저장소는 svn이지만 git을 쓰고싶어서 git-svn을 사용하려 했는데
cygwin에 포함된 git-svn이 다음과같은 이상한 에러를 내면서 제대로 동작하지 않았다.

      0 [main] perl 4888 child_info_fork::abort: address space needed by 'cygsvn_client-1-0.dll' (0x13A0000) is already occupied


solution:
모든 cygwin process를 닫고 cmd에서 ash또는 dash에서 다음을 수행;
(exit all the cygwin processes and in the shell(ash or dash));

cd \cygwin\bin
$ ash
$ PATH=. rebaseall -v
......
foo/bar.dll new base = 1234, new size = 56
......


2013-04-10 윈도우 업데이트 실행 후에 동일 증상 나타났음 (아마도 root cause 인듯)

happy hackin'


1 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

03-29 19:33