# Cosmopolitan libc - Build-Once Run-Anywhere C

> Clean Markdown view of GeekNews topic #3489. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=3489](https://news.hada.io/topic?id=3489)
- GeekNews Markdown: [https://news.hada.io/topic/3489.md](https://news.hada.io/topic/3489.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2020-12-29T10:15:32+09:00
- Updated: 2020-12-29T10:15:32+09:00
- Original source: [justine.lol](https://justine.lol/cosmopolitan/index.html)
- Points: 9
- Comments: 5

## Topic Body

- C코드를 어디서든 실행가능하게 만들어주는 라이브러리

ㅤ→ Java랑 비슷하지만 인터프리터나 VM필요없음

ㅤ→ Go/Rust 수준의 이식성을 제공하지만 C언어 그대로 사용

ㅤ→ 제공된 5개의 라이브러리 파일로 컴파일하면 그대로 맥/윈도우/리눅스 지원

- glibc 수준의 속도

- ape(αcτµαlly pδrταblε εxεcµταblε) 라는 포맷을 만들어서 사용

ㅤ→ Windows Portable Executable 을 UNIX 6th 에디션 쉘스크립트로 만들수 있다는 사실을 이용

ㅤ→ 포터블하지만 Go 버전 헬로월드 보다 100x 작음

- 내부에 BIOS 부트로더를 내장해서 베어메탈 부팅 후 실행도 가능

## Comments



### Comment 4046

- Author: nicewook
- Created: 2020-12-29T10:55:45+09:00
- Points: 1

어떻게 사용될 수 있을지 상상이 안되네요. 재미집니다

### Comment 4044

- Author: xguru
- Created: 2020-12-29T10:15:50+09:00
- Points: 2

작성자인 Justine Tunney 는 유명한 해커입니다.

https://en.wikipedia.org/wiki/Justine_Tunney

베어메탈 실행 방법은 작성자가 HN에 댓글로 달아줬네요

https://news.ycombinator.com/item?id=25558363

뭔가 C로 코맨드라인 도구를 만드는 새로운 방법이 될수 있을듯 하네요

깃헙을 뒤져보는데.. 안에 각 OS를 표시한 ASCII 아트들이 인상적입니다.

https://github.com/jart/cosmopolitan/blob/master/ape/ape.S

### Comment 4045

- Author: bbulbum
- Created: 2020-12-29T10:50:25+09:00
- Points: 1
- Parent comment: 4044
- Depth: 1

코드의 주석이... 아트네요.. 아트..

### Comment 10577

- Author: 525hm
- Created: 2022-06-17T09:56:18+09:00
- Points: 1
- Parent comment: 4045
- Depth: 2

ㅋㅋㅋㅋ 멋지네요 처음 로고는 그런가보다 했는데 MS-DOS부터 감명받았습니다

### Comment 4049

- Author: galadbran
- Created: 2020-12-29T14:52:27+09:00
- Points: 1
- Parent comment: 4045
- Depth: 2

주석에 저런게 있으니까 뭔가 진짜 재미로 개발한다는 느낌이 드는데요 ㅎㅎㅎ
