시작 사이트 등록

sebsite

sebsite.pwDR 29 Accessible 300 views

개발 프로그래밍 A personal blog post explaining a hacky but portable technique for reading C's errno from non-C languages such as Hare without writing a C wrapper function.

No rating yet; write the first review

Editor's Review

For reference only
sebsite page preview

The value here is the low-level problem-solving: it dissects why errno's macro expansion is unreliable across libc implementations and then demonstrates a workaround using symbol interposition. It is aimed at systems programmers comfortable with ABI details, not general readers, and the deliberately

Site introduction

This page is a single technical write-up on sebsite, a personal site, documenting an unconventional method for retrieving the value of errno from outside C. The author frames it as a “cursed” experiment made some time ago, with the explicit goal of portability across libc implementations and no reliance on a C wrapper function.

The core problem is that errno is defined as a macro whose expansion is implementation-specific and carries no stability guarantees. When calling libc functions from another language, such as Hare in the examples shown, there is normally no portable way to read the error value afterward. The post walks through the constraints before presenting the hack itself.

The technique relies on symbol-level tricks rather than a clean API, so it suits programmers already comfortable with linking, symbols, and ABI behavior. Readers who just want a supported errno accessor will not find one here; the value is in the reasoning and the demonstration of what is possible at the boundary between languages.

Use it as a reference for understanding errno’s portability pitfalls and for seeing how far one can push interposition in practice. Treat the approach as an experiment to learn from rather than production guidance, and verify behavior against your target libc before adopting anything similar.

Comments & Ratings

0

No comments yet. Be the first to review.

Write the first comment

Your email won't be made public; fields marked with * are required.

Rate this site

Click the stars to rate; rating is optional, and clicking the selected star again cancels it.