title: Error using __declspec(dllexport) : Unknown type name '__declspec'
body: <p>I am trying to export a function to shared object (<code>.so</code>) using NDK from c++ using terminal on macOS mojave . I have installed latest versions of command line tool and Xcode.</p>
  
  <p><em>Here's my <code>GetNumber()</code> which i want to export</em> </p>
  
  <pre><code>#include &lt;iostream&gt;
  #define DllExport __declspec(dllexport)
  
  extern "C" {
     DllExport int GetNumber() {
        return 5 ;
     }
  } 
  </code></pre>
  
  <p><em>After compiling the code using NDK , it throws the following error</em> ,</p>
  
  <p><a href="https://i.stack.imgur.com/Yyuoy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yyuoy.png" alt="enter image description here"></a>    </p>
  
  <p>I tried out clang and Xcode compiler as well as on tried same patterns on Windows and Ubuntu . I get the same error .</p>
  
  <p><a href="https://software.intel.com/en-us/articles/building-an-android-command-line-application-using-the-ndk-build-tools" rel="nofollow noreferrer">Tutorial i followed to export shared library using ndk</a> </p>