title: Porting msvc code to Android/ios
body: <p>I have a pretty large project written in C++ for Windows, with some MSVC-specific fancy things, like <code>__declspec(property)</code>, usage of SEH, extra template and macro flexibility, intrinsics and etc.</p>
  
  <p>In a nutshell it consists of various applications and a shared library (lib), which is a pretty large "algorithmic" code. It's written entirely in plain C++ (MSVC's version of it, as I said), not dependent on any 3rd-party, all the code is "hand-made", no stdlib, STL, Boost or etc.</p>
  
  <p>Now this code needs to be ported to mobile platforms, namely Android and iOS.</p>
  
  <p>The code <em>should</em> be platform-independent. No explicit dependence on OS, besides the very basic things, like heap memory allocation. It does depend on some Windows-specific things: SEH, TLS, but those are the things I can sacrifice, if they can't be replaced.</p>
  
  <p>And I'm thinking about how to deal with it. Cleaning the whole code from MSVC-specific stuff is possible, but not convenient. I'd prefer to keep them, and definitely I don't want to keep several codebases for different platforms.</p>
  
  <p>So, what are the options at my disposal?
  As I understood, there are C++ compilers for Android (part of NDK), but they are probably standard C++ compliant. Anyway, iOS development is based on Objective-C, which is a superset of plain C.</p>
  
  <p>This led me to an idea to "compile" the existing MSVC-specific C++ code into a plain C. There is an option in MSVC compiler to generate "listing" files, containing the assembler code. I guess if there's an option to create appropriate listings containing C-code. Or alternatively MSVC-compliant 3rd party C++ -> C converters.</p>
  
  <p>Any thoughts?</p>