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

Stephen Tetley stephen.tetley at
Wed Dec 9 15:47:21 EST 2009

Hi Erik

I'm neither expecting nor obliging Unix users to do anything...

pexports (the C tool) extracts function names from dlls. In one of the
messages on the PortAudio thread [1], John Lask explained how to get
from a standard Windows .dll to an .a file suitable for GHC (which is
bundled with a MinGW gcc). Before John's explanation I thought you had
to build the .a file yourself - or do some magic with GreenCard which
is now quite antiquated, but with pexports you can do the missing step
(I almost feel a commuting diagram coming on at this point...).

When I looked for pexports on Sunday it seem rather abandoned (it
didn't seem to be included in MinGW, M Xyz's tutorial points to a very
old version...) so I thought I'd see if I could do the job myself in
Haskell. Anyway it was a bit more work that I imagined and when I was
web-searching for pexports today I found that it was included in
MinGW. So my Haskell version is redundant - but pexports isn't quite
the full story, seemingly people often have to hand-edit the .def file
it produces. If someone else has a use compelling enough that it would
benefit the Haskell community on Windows, I don't mind extending and
polishing my version so it can do a bit more than pexports; but I get
by with cygwin and MinGW myself, so I've no personal inclination to
spend any more time on it (and of course it is no help whatsoever for
includes files and related problems...).

Best wishes



2009/12/9 Erik de Castro Lopo <mle+hs at>:
> Stephen Tetley wrote:
>> If there are compelling uses that aren't covered by pexports and would
>> ease Haskell C binding problems on Windows, I don't mind polishing up
>> my tool, but otherwise I've exhausted my natural interest.
> I think the main problem you'll face is that pexports is a windows
> only tool. If cabal can be made to use pexports on windows and something
> else on Unix then that should be ok.
> If you expect people writing Haskell bindings in Unix to jump though
> hoops to hook pexports into a windows specific build, you are heading
> for disappointment :-).
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at

More information about the Haskell-Cafe mailing list