[Haskell-cafe] Help from C libraries experts
rendel at cs.au.dk
Thu Apr 30 08:35:58 EDT 2009
> My goal is to have a place where one can find reliable and
> comprehensive low-level bindings to foreign libraries, so that
> writing higher level bindings becomes an easier task.
Like others, I think you should consider making this place not a single
package, but a bunch of packages. For example, one could make a
convention that a package named bindings-foo contains low-level bindings
to a c library foo.
In your guidelines, you say:
> Code should be portable and easy to build.
Does your understanding of "portable" include Windows?
The problem with windows is that you usually do not have these c
libraries installed, and no easy way to install them, so a binding is
not enough. For example, the Haskell package zlib bundles the actual
zlib c code for Windows users, which works not too bad. Do you plan to
support this kind of thing in your bindings project?
I am not sure which kind of c libraries can be reasonably included in
cabal packages. I guess the idea breaks with more complicated build
systems for the c library, and with libraries written in other languages
then c, and with libraries which are supposed to be linked against
dynamically, and with complicated license situations, and in all kinds
of other situations. Anyway, if there are more such libraries then just
zlib, maybe a naming convention would be helpful, like:
- bundled-foo is a package which contains just the c code of foo
- bindings-foo contains the low-level bindings for foo
Now bindings-foo could use cabal configurations to depend on the c
library directly on most systems, but depend on bundled-foo on Windows.
This way, on all systems, you could just install bindings-foo and be
able to use the library. If you have special needs, you could still use
an explicit flag on Windows to configure bindings-foo not to depend on
bundled-foo, and install the c library yourself instead.
More information about the Haskell-Cafe