[Haskell-cafe] Same code, system, but different arch using Win32 for reading registry.
makos999 at gmail.com
Fri Apr 7 19:51:31 UTC 2017
Having a binary compiled on either x86 or x64 system (same installation,
utilizing stack) in order to preserve compatibility against x64 systems.
Actually, not to have 2 separate executable for each, that would be the
overall goal. However it surprises me when running the x86 .exe
utilizing Win32-184.108.40.206 package with ghc-8.0.2, reading out a registry
key fails on x64 system with the following:/
/me.exe: RegOpenKey: invalid argument (The system cannot find the file
That would be fine, however the key does exists. When same code, same
system, but the .exe built to be x64 it runs like a charm.
A couple of question, which some of them eventually will not make sense,
- Can it be ghc code optimization issue?
- but this is a runtime check in IO, if so, how?
- Yes, I could use a built-in windows system command and parse the input
of that; unless absolutely necessary I would not introduce another
dependency (system package). Would love to solve it with the currently
- the issue just puzzles me... I would know the answer if possible.
- Is it more library (Win32), ghc, binary I generate, issue?
What library can I use to detect a system's architecture which works in
Another thing which convoluted in the issue...
The function, /getSystemInfo :: IO SYSTEM_INFO, /can read out the
underlying architecture. When compiled on x86 and run on x64 it would
tell me: "I am running on x86". That's failure.
Most importantly: what is the obvious I am missing?
Thank you for your insights!
Ps.: Would you/we need sample code to puzzle about I can quickly weld
one. - not sure if necessary.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe