title: Can't access DLL function in python
body: <p>I generated a DLL file from a C++ file :</p>
  <p>privilegeLib.cpp :</p>
  <pre><code>#include &quot;privilegeLib.h&quot;
  #include &quot;pch.h&quot;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  string helloworld(void) {
      return &quot;hello world&quot;;
  }
  </code></pre>
  <p>privilegeLib.h :</p>
  <pre><code>#pragma once
  #define DllExport __declspec( dllexport )
  #include &lt;string&gt;
  using namespace std;
  
  extern &quot;C&quot; {
      //PRIVILEGELIB_API string helloworld();
      __declspec(dllexport) string helloworld(void);
  }
  
  </code></pre>
  <p>dllmain.cpp :</p>
  <pre><code>// dllmain.cpp : Définit le point d'entrée de l'application DLL.
  #include &quot;pch.h&quot;
  
  BOOL APIENTRY DllMain( HMODULE hModule,
                         DWORD  ul_reason_for_call,
                         LPVOID lpReserved
                       )
  {
      switch (ul_reason_for_call)
      {
      case DLL_PROCESS_ATTACH:
      case DLL_THREAD_ATTACH:
      case DLL_THREAD_DETACH:
      case DLL_PROCESS_DETACH:
          break;
      }
      return TRUE;
  }
  
  
  </code></pre>
  <p>And i'm trying to use the helloworld function from a python script :</p>
  <pre><code> libCalc = ctypes.WinDLL(&quot;./privilegeLib.dll&quot;)
  
   print(libCalc.helloworld())
  </code></pre>
  <p>Python seems to correctly read the dll file but it doesn't find the function helloworld :</p>
  <pre><code>AttributeError: function 'helloworld' not found
  </code></pre>
  <p>Do you have an idea ?</p>
  <p>Thanks.</p>