[Haskell-cafe] binding to C libraries on Windows was Low Level Audio - Writing bytes to the sound card?

Andrew Coppin andrewcoppin at btinternet.com
Sun Dec 6 08:18:59 EST 2009


john lask wrote:
> I think there are some misapprehensions here:-
>
> Many haskell packages binding to c libraries will compile with ghc
> without problems on windows - without cygwin, without mingw/msys system.

OK, well I haven't tried building every C binding on all of Hackage, 
just a few of them. So far none of them have worked. (Including 
wxHaskell, SDL, one of the database packages, etc.) It's got to the 
point where I've simply given up trying. Most such packages just don't 
seem to work on Windows, and nobody on the mailing lists or on IRC has 
any clue why. (I guess because few people in the Haskell community use 
Windows and understand how it's supposed to work.)

> Some such packages build "out of the box" on windows, like the zlib
> package which contains the c source for the c zlib library. GHC is able
> to compile and build this packages without any other c
> compiler/libraries/unix emulators etc because ghc itself contains part
> of the gcc c compiler tool chain and comes with all c standard headers,
> c++ headers and c/c++ runtime libraries.

Yes, I realised long ago that GHC uses GCC and other GNU build tools. 
(Presumably this makes porting to Windows far easier.) More recently I 
realised that it also includes a surprisingly large set of header files, 
seemingly including the entire Win32 API, which is interesting.

> There
> is only one gotch-ya - you need to have a import library for the gcc
> tool chain (thats what ghc uses) i.e. a ".a" library and not the native
> windows ".LIB" import library.

They're different?? o_O

Oh. Suddenly several things seem clearer...

> If you don't have ".a" import library
> but have the dll then the '.a' import library be built for any dll
> relativley easily.

Any idea how?

> the bigest problem hamperring cleaner builds of haskell packages on
> windows is the lack of any standardised scheme for the installation of
> c-libraries and header files (and of course the availability of a
> suitable build of the library).

Isn't one of Cabal's jobs to figure out where stuff is? Can't we get 
Cabal on Windows to say "hey, I need to find foo.h, you know where that 
is?" Or something like that?

> Another problem hampering the install of haskell packages on windows is
> the use of the unix autoconf build system (./configure)   - package
> writters note!

Heh. I found one Wiki page once describing how to set up a Cabal 
package. When it started talking about how to integrate Automake, I hung 
my head is dispair. (I believe the page in question is fixed now. But a 
lot of package authors seem to assume that everybody just uses Unix of 
some kind...)



More information about the Haskell-Cafe mailing list