[Haskell-cafe] Re: binding to C libraries on Windoww
Erik de Castro Lopo
mle+hs at mega-nerd.com
Mon Dec 7 17:21:54 EST 2009
Andrew Coppin wrote:
> Well, I don't know. It's going to vary from package to package, but most
> things that have a semi-official Windows version either come as a
> Windows Installer package (which, one presumes records where it put
> everything *somewhere* in the Windows registry)
Is that done automatically or does the installer have to explicity
set it? What does it look like?
The reason I ask is that I release a binary windows installer for
libsndfile. The binaries are generated using a Linux to Windows
cross-compiler and for the win32 version I run the testsuite under
Wine (windows API emulator). I then run INNO Setup under wine to
generate the installer executable.
> > On a related matter, many packagers resort to using configure-style
> > configuration setups to assist with binding to C libraries. Cabal is
> > now sophisticated enough to handle many of these steps (although not
> > all), however packagers may not have had an opportunity to update
> > their build process to remove the dependency on "configure". These
> > packages will continue to require cygwin or mingw for the "configure"
> > step.
> Ah yes, this is pretty much guaranteed to make stuff not work on
> Windows. :-) Still, all Unix systems have Automake, configure, etc., so
> I guess most people don't even think twice before using it.
There are bigger problems than that. The Microsoft compiler still doesn't
support large chunks of the 1999 ISO C Standard. There is stuff in that
standard that makes my life easier so I use it in libsndfile. Its also
why I much prefer to cross compiler from Linux to Windows with a GNU
compiler that supports the vast majority of the 1999 ISO C Standard.
I would be possible to make libsndfile compile with Microsofts compiler
but it would add a whole bunch of #ifdefs all over the place making the
code base fragile and in the long term less maintainable and reliable.
> > MS hasn't done so,
> > which means that C developers would need to unacceptably compromise
> > unix support in their packages in order to better support Windows.
> I don't know about that... Lots of commercial and open-source products
> are available for Windows and Unix, seemingly without any problem. (GTK,
> for example...) I don't deny that adding Windows support is _a lot more
> work_ than adding support for just another Unix, though.
Ignoring bugs and features that are common across all platforms in libsndfile
I have spent at least an order of magnitude more time and effort getting
things working with windows that I have with all of the Unixes (including
OSX) summed together. This for a platform I don't use.
> Yeah, it seems for the time being any Haskellers wanting to work on
> Windows have to choose either to not use external C libraries or to
> install the entire GNU toolchain. *sigh*
If those libraries use parts of the C99 standard then yes. Microsoft
has had 10 years to make their compilers compliant. Ask them why they
Erik de Castro Lopo
More information about the Haskell-Cafe