<div dir="ltr"><div>Hi Kees,</div><div><br></div><div>Would It be possible for you to try with GHC 7.10.3 or 8.0.1?</div><div><br></div><div>A bunch of things have changed with the linker in these two versions which should make</div><div>linking against packages easier.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"> <command line>: can't load .so/.DLL for:<br> d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll (addDLL: could not load DLL)</blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"> ghc.exe: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq: %1 is not a valid Win32<br> application.</blockquote><div><br></div><div>This seems to be coming from the runtime linker, if indeed d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll</div><div>can be found then either it's the wrong bitness/image type or libpq.dll has dependencies on other dlls.</div><div><br></div><div>7.10.1 is not able to load these then as the search path won't be correct. To test this you can add</div><div>d:/PROGRA~2/POSTGR~1/9.3/lib\ to your path and try loading it again.</div><div><br></div><div>If that doesn't work and you want to know what's really going on, you can enable loader snaps</div><div>in gflags for GHC.exe and GHCi.exe (or runHaskell, what ever it is you're using) and attach a debugger like gdb</div><div>or windbg. <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/ff556886(v=vs.85).aspx">https://msdn.microsoft.com/en-us/library/windows/hardware/ff556886(v=vs.85).aspx</a></div><div><br></div><div>You'll then be able to see the OS's trace messages for the loader and it should tell you exactly what's wrong.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"> >From the msys prompt: pexports "d:\program<br> files\postgreSQL\9.3\bin\libpq.dll" > libpq.def</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"> >From the msys prompt: dlltool  -d libpq.def -l libpq.a</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"></blockquote><div><br></div><div> Import libraries are supported by the GHC but not ghci or any other interpreted mode (until 8.0.2)</div><div>So this would only work for the compiled program without Template Haskell.</div><div><br></div><div>Regards,</div><div>Tamar</div></div>