일반적으로 stdio.h를 include 하면 stdio.h에 정의되어진 함수들을 사용할 수 있는걸로 알고 있습니다.
예를들어 printf 함수가 stdio.h에 정의되어 있고
구현은 다른 어딘가에 stdio.h를 link 하고있는 파일에 되어있는게 맞나요? 만약 그렇다면 printf 가 구현되어 있는 파일은 무엇인가요?
말씀하신 c 함수들은 c 라이브러리에 있습니다. 링킹할 때, cc -o hello hello.c -lc 이렇게 링킹하는데, 링킹 옵션을 주지 않아도 링킹이 됩니다.
musl 이라는 c 라이브러리를 예를 들겠습니다.
http://git.musl-libc.org/cgit/musl/tree/src/stdio/printf.c
http://git.musl-libc.org/cgit/musl/tree/src/stdio/vfprintf.c
리눅스에 glibc 라는 c 라이브러리가 기본 설치되어 있을 것이니, glibc 소스코드에 printf 함수 소스코드가 있겠죠.
안드로이드는 bionic 이라는 c 라이브러리가 기본 설치되어 있을 것이니, bionic 소스코드에 printf 함수 소스코드가 있겠죠.
https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/stdio/stdio.cpp
https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/stdio/vfprintf.cpp
https://en.wikipedia.org/wiki/C_standard_library
기본적인 내용에 대해 도와주셔서 감사합니다!
이 글이 참고가 될 듯 하네요
https://stackoverflow.com/questions/37153864/where-the-compiler-find-printf
커널에 다운로드 받으면 아래 디렉토리에 소스코드있으니 관심 있으면 한번 찾아보세요
./arch/m68k/sun3/prom/printf.c ./arch/sparc/prom/printf.c ./arch/x86/boot/printf.c
명확하게 나와있군요 도움이 많이 됐습니다 감사합니다.
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
말씀하신 c 함수들은 c 라이브러리에 있습니다.
말씀하신 c 함수들은 c 라이브러리에 있습니다. 링킹할 때, cc -o hello hello.c -lc 이렇게 링킹하는데, 링킹 옵션을 주지 않아도 링킹이 됩니다.
musl 이라는 c 라이브러리를 예를 들겠습니다.
http://git.musl-libc.org/cgit/musl/tree/src/stdio/printf.c
http://git.musl-libc.org/cgit/musl/tree/src/stdio/vfprintf.c
리눅스에 glibc 라는 c 라이브러리가 기본 설치되어 있을 것이니, glibc 소스코드에 printf 함수 소스코드가 있겠죠.
안드로이드는 bionic 이라는 c 라이브러리가 기본 설치되어 있을 것이니, bionic 소스코드에 printf 함수 소스코드가 있겠죠.
https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/stdio/stdio.cpp
https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/stdio/vfprintf.cpp
https://en.wikipedia.org/wiki/C_standard_library
이해했습니다
기본적인 내용에 대해 도와주셔서 감사합니다!
이 글이 참고가 될 듯 하네요
이 글이 참고가 될 듯 하네요
https://stackoverflow.com/questions/37153864/where-the-compiler-find-printf
커널에 다운로드 받으면 아래 디렉토리에 소스코드있으니 관심 있으면 한번 찾아보세요
감사합니다
명확하게 나와있군요 도움이 많이 됐습니다 감사합니다.
댓글 달기