

Ask HN: Resources for learning to write wrappers to C libraries - prick

My background is in a little python and i'm learning Scheme right now, but whenever I try to create something non-trivial in Scheme I never complete it, because of the non-availability of a wrapper to a C library that I might need for that particular project. My knowledge of C is very rudimentary and hence I'm unable to write the wrapper myself.<p>If I were able to write a wrapper to the C library, I would be able to complete the projects and probably become better at Scheme (and also in whatever language I decide to learn in the future).<p>Does anyone know of tutorials or books that are specifically geared towards writing wrappers or something like that?<p>I tried searching google but didn't find what I was looking for.
======
Kliment
With Python, there is a well-defined and well-documented C API, as well as
support for ctypes. Ctypes allows you to call into C-interfaced libs with very
little code. The Python C API allows you to write modules in C that behave
like modules in Python. With Scheme, there are multiple implementations and no
standard one, but most implementations provide a functionality for calling
external code. Here's a nice list: <http://community.schemewiki.org/?ffi>
Rather than tutorials, I'd start by trying to dissect existing library
wrappers and figuring out how they work. This is how I learned to write Python
extensions.

~~~
prick
thanks for the tip, i guess that would be the best way.

