title: Are statically compiled pure standard C++ programs portable provided running on the same architecture?
body: <p>When a program is <strong><em>recursively</em></strong> statically compiled (assuming all linked libraries allow static compilation and are kind-of platform independent in their code, I know this is possible because I managed to statically compile nano from Ubuntu to run on x86 Android and it worked because it didn't link to system libraries), is it really safe to assume it is self-contained? That is, does it need anything else from the platform (i.e. Linux, Windows, ..., etc)? I suspect the answer is yes. So accordingly...</p>
  
  <p>For simplicity, if I take this program (no dependencies):</p>
  
  <pre><code>int main(){
        return 0;
  }
  </code></pre>
  
  <p>I can easily compile this statically (since obviously it has no dependencies) and should produce native code that runs on the underlying architecture (say x86 architecture). </p>
  
  <p>I know there are wrappers that would pass environment variables and other things that will differ depending on the platform (e.g. Windows exe or Linux executable). </p>
  
  <p>Putting the wrappers aside for a minute, the question is: if I compiled the previous program statically using GCC on Linux, would I <strong><em>theoretically</em></strong> be able to run it on Windows? </p>
  
  <p>Back to wrappers, if I know how to convert the wrappers from Windows to Linux and vice-versa, would I need to recompile the program to move it from one to another? </p>