[Haskell-beginners] Same code, system, but different arch using Win32 for reading registry.
Akos Marton
makos999 at gmail.com
Fri Apr 7 19:51:31 UTC 2017
Dear Haskellers,
The setup:
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-2.5.4.1 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
specified.)/
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,
but still:
- 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
utilized weapons.
- 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
this scenario?
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!
Best, Akos
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...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170407/f0187166/attachment-0001.html>
More information about the Beginners
mailing list