title: Visual Studio 2017 ARM cross compiling linker crash
body: <p>So I have been working on a project for my raspberry pi. But for convenience, I would like to build it using visual studio 2017. It is plugin based so the plugins implement an interface and export a function that returns an instance to the implementing class. The problem I am experiencing is a compiler crash, that only occurs if I try to export said function.</p>
  
  <pre><code>extern "C" Plugin __declspec(dllexport) *CreatePlugin(Data *r);
  </code></pre>
  
  <p>This is the declaration for the function the plugin has to implement to return its implementation of the 'Plugin' interface.</p>
  
  <p>The MSVC Compiler gives me the following error message:</p>
  
  <pre><code>1&gt;   Bibliothek "build\Debug\Raspberry\libSMH.so" und Objekt "build\Debug\Raspberry\libSMH.exp" werden erstellt.
  1&gt;
  1&gt;LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage
  1&gt;
  1&gt;  Version 14.15.26726.0
  1&gt;
  1&gt;  ExceptionCode            = C0000005
  1&gt;  ExceptionFlags           = 00000000
  1&gt;  ExceptionAddress         = 0F20CC4E (0F200000) "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX86\arm\VCRUNTIME140.dll"
  1&gt;  NumberParameters         = 00000002
  1&gt;  ExceptionInformation[ 0] = 00000001
  1&gt;  ExceptionInformation[ 1] = FEE90000
  1&gt;
  1&gt;CONTEXT:
  1&gt;  Eax    = 00FE5678  Esp    = 006FEE34
  1&gt;  Ebx    = 00FE55F8  Ebp    = 006FEE60
  1&gt;  Ecx    = 00000080  Esi    = 00FE55F8
  1&gt;  Edx    = 00000080  Edi    = FEE90000
  1&gt;  Eip    = 0F20CC4E  EFlags = 00010247
  1&gt;  SegCs  = 00000023  SegDs  = 0000002B
  1&gt;  SegSs  = 0000002B  SegEs  = 0000002B
  1&gt;  SegFs  = 00000053  SegGs  = 0000002B
  1&gt;  Dr0    = 00000000  Dr3    = 00000000
  1&gt;  Dr1    = 00000000  Dr6    = 00000000
  1&gt;  Dr2    = 00000000  Dr7    = 00000000
  </code></pre>
  
  <p>This does not occur if I remove the __declspec(dllexport) from the function declaration above.</p>
  
  <p>Does anyone have any experience with cross compiling shared libraries for ARM, and might have an idea on how to fix this?</p>