Hard earned hints for using Win32 GHC 4.08.2 and HDirect.
Thu, 5 Apr 2001 16:12:17 +1000
I thought I might share some hints on making HDirect work with GHC 4.08.2.
Installing and checking GHC:
- Get the installer from the GHC downloads page, do the installation per
the instructions there, including Cygwin etc.
- Remove the digit "1" from the bottom of lib/imports/win32/Win32.hi
- Remove old .hi files from any program source directories you may have.
- To test, try compiling the Windows hello.lhs example using the command
line "ghc hello.lhs -o hello.exe -package win32" and run hello.exe.
- If you get linker errors about "import____timezone_dll" from time.o, you
need to add the line:
push(@SysLibrary, '-lcrtdll') if ($TargetPlatform =~
below the line:
push(@SysLibrary, '-lwsock32') if ($TargetPlatform =~
in your "bin/ghc" driver script. This is because the distribution is built
with an old version of Cygwin GCC which links against crtdll.dll rather than
msvcrt.dll when -mno-cygwin is set on the command line (GHC uses mingw32).
By doing this, spare symbols are resolved after linkage with msvcrt.dll. DO
NOT SUBSTITUTE -lmsvcrt with -lcrtdll. If you substitute, you will get
errors about running out of resources on fileOpen at run time.
- You may also need to update your GCC Mingw32 libraries and headers from
the Sourceforge Mingw32 downloads page if you have unexplained crashes.
Building HDIrect 0.17
- Uninstall previous versions of HDirect including "lib/imports/com" and
associated libraries, which don't work very well with GHC 4.08.2.
- Get the source from the HDirect web site and untar it somewhere.
- You may need to edit "lib/WideStringSrc.c" if you use the latest Cygwin
distribution to remove a clashing definition and declaration of wcslen().
- Build per the instructions in the INSTALL file.
- This gives you a bare bones ihc.exe which cannot handle type libraries.
- Install the freshly built lib/*.hi files in a new ghc "lib/imports/com"
directory and also the libraries (libHScom.a, libhdirect.a) into ghc's "lib"
- Do "make clean", deleting "src/ihc.exe" by hand.
- Set SUPPORT_TYPELIBS=YES in "src/Makefile"
- "make boot", "make", then "make lib" as before.
- You now have version 0.17 of HDirect for Windows.
Why does ihc ignore binary interfaces in type libraries such as dx7vb.dll?