IT한 것/unix

AIX 이해가 안돼는 undefined symbol 오류 발생시.

lovian 2009. 7. 3. 16:17
분명히 symbol이 존재하는 데도 링킹이 실패하는 경우가 발생했다.

혹시 이름에 오탈자가 있었나? 그것도 아니다.

진실은 기본에 있었다.

C and C++ Application Development on AIX 2nd edition 문서를 참고하면

If you are creating a shared object and want all symbols to be exported, then you
do not need to use an export file. You can use the -bexpall linker option, which
will automatically export all global symbols (except imported symbols,
unreferenced symbols defined in archive members, and symbols beginning with
an underscore). Additional symbols may be exported by listing them in an export
list. Any symbol with a leading underscore will not be exported by this option.
These symbols must be listed in an exports list to be exported.

나름 요약하자면, export all 옵션을 이용하는 방법과 export list를 이용하는 두 가지 방법이 있으며, export list에 의해서 내보내기를 할 수 있기 때문에 export all을 이용하면 _로 시작하는 symbol은 내보내지 않도록 되어 있고, 이런 symbol을 내보내고 싶으면 export list를 쓰라는 것으로 이해했다.

말은 길었는데 답은 간단히 우리가 부르는 언더바(underscore)로 시작하는 symbol은 export all 옵션으로는 내보내기에서 제외된다는 것.