<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Dear Haskellers, <br>
</p>
<div>The setup:<br>
</div>
<div> 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:<i><br>
</i></div>
<p><i>me.exe: RegOpenKey: invalid argument (The system cannot find
the file specified.)</i><br>
</p>
<p>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. <br>
</p>
<div>A couple of question, which some of them eventually will not
make sense, but still:<br>
</div>
<div> - Can it be ghc code optimization issue?<br>
</div>
<div> - but this is a runtime check in IO, if so, how?<br>
</div>
<div> - 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. <br>
</div>
<div> - the issue just puzzles me... I would know the answer if
possible.<br>
- Is it more library (Win32), ghc, binary I generate, issue? <br>
</div>
<p>What library can I use to detect a system's architecture which
works in this scenario? <br>
</p>
<div>Another thing which convoluted in the issue...<br>
</div>
<div>The function, <i>getSystemInfo :: IO SYSTEM_INFO, </i>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.<br>
</div>
<div><br>
</div>
<div>Most importantly: what is the obvious I am missing?<br>
</div>
<div> <br>
</div>
<div> Thank you for your insights! <br>
</div>
<div> Best, Akos<br>
</div>
<div class="protonmail_signature_block
protonmail_signature_block-empty">
<div class="protonmail_signature_block-user
protonmail_signature_block-empty"><br>
</div>
<div class="protonmail_signature_block-proton
protonmail_signature_block-empty"><br>
</div>
</div>
<div><br>
</div>
Ps.: Would you/we need sample code to puzzle about I can quickly
weld one. - not sure if necessary.
</body>
</html>