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

john lask jvlask at hotmail.com
Sat Dec 5 17:17:45 EST 2009


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.

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.

Other packages such as SDL package are relatively straightforward to 
build on windows - all that is required is to have an import library 
corresponding to your dll (or static lib) and the headers. You then 
update the library path field in the cabal file and include path. 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. If you don't have ".a" import library 
but have the dll then the '.a' import library be built for any dll 
relativley easily.

The correct '.a' import libraries and the libraries themselves for many
standard unix/gnu packages can be found under the gnuwin32 project. Many 
unix libraries provide a windows build based on the mingw port of the 
gcc tool chain which will contain the correct import library.

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)

Another problem hampering the install of haskell packages on windows is 
the use of the unix autoconf build system (./configure) , for which 
there is no substitute on windows other than cygwin and to lesser extent 
msys/mingw, this problem could be obviated by the provision of a 
standard win32 conf (forgetting about win64 for the moment) - package 
writters note!


> Date: Sat, 5 Dec 2009 20:58:14 +0000
> Subject: Re: [Haskell-cafe] Low Level Audio - Writing bytes to the sound card?
> From: stephen.tetley at gmail.com
> To: Haskell-Cafe at haskell.org
> CC: 
> 
> Hi Andrew
> 
> 
> 
> 2009/12/5 Andrew Coppin <andrewcoppin at btinternet.com>:
> 
> > I don't think it should be necessary to install a Unix emulator just so that
> > I can write Windows programs. Maybe others disagree.
> >
> 
> ...
> 
> >
> > I'm by no means an expert here, but isn't it usual for C libraries on
> > Windows to be supplied as a compiled DLL and a header file for using it? I
> > don't quite understand why you need a C compiler.
> 
> The thing is, all the bindings on Hackage (or at least something most
> likely above 95%) are to "Unix" C libraries so you need a C compiler
> and a Unix emulator to use them. I do have have some sympathy with
> your point though - it is possible to get things to compile once you
> have Cygwin, but deployment on any other machine Windows thereafter is
> 'challenging' to say the least.
> 
> 
> 
> 
> > Apparently there is some talk of removing OpenGL from the Haskell Platform.
> > And if this happens, it'll be one more thing I can't use on Windows. :-(
> 
> 
> I didn't realise until I looked today that OpenGL was in the Haskell
> Platform. If the proposal to remove it is from Sven Panne then fair
> enough, otherwise it would be a bit disappointing - it always "just
> worked" when it was part of GHCs extralibs...
> 
> Best wishes
> 
> Stephen
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
 		 	   		  
_________________________________________________________________
If It Exists, You'll Find it on SEEK Australia's #1 job site
http://clk.atdmt.com/NMN/go/157639755/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091205/0abf8b3f/attachment.html


More information about the Haskell-Cafe mailing list