title: WASM link error: function signature mismatch
body: <p>I've been using WASM via emscripten for a few weeks now and had been making good progress, until this error:</p>
  
  <pre><code>exception thrown: RuntimeError: function signature mismatch,RuntimeError: function signature mismatch
  </code></pre>
  
  <p>This started happening in code that previously worked and seems to be something to do with WASMs lack of support for 64bit integers in javascript and the offsets used in file management. I've made an isolated case:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main(int argc, char const *argv[])
  {   
      char test[30];
      std::cout &lt;&lt; __LINE__ &lt;&lt; std::endl;
      FILE *f = fopen("minimal_call_dispatch.cpp","ra");
      std::cout &lt;&lt; __LINE__ &lt;&lt; std::endl; 
      fseek(f, 100, SEEK_SET);
      std::cout &lt;&lt; __LINE__ &lt;&lt; std::endl;
      fclose(f);
      std::cout &lt;&lt; __LINE__ &lt;&lt; std::endl; 
      return 0;
  }
  </code></pre>
  
  <p>building with:</p>
  
  <pre><code>call emcc -o ./test.js test_file.cpp -s WASM=1 -s NO_EXIT_RUNTIME=1 -std=c++1z 
  </code></pre>
  
  <p>Which outputs '6\n8\n' before failing on 'fseek' due to the mentioned error.</p>
  
  <p>Somewhere along the line, I suspect that wasm is trying to use headers that communicate with javascript that have 64bit integers instead of 32bit ones but I can't see how that could have happened. 
  I'm going to try re-installing emscripten but even if that works, I'd like to get a better idea of what's causing this.</p>
  
  <p>As a work around, does anybody know how to get emcc to ignore worries over 64bit integers and silently convert them to 32bit? I'm not looking to address more than 3gigs of ram, after all.</p>