title: Importing a dll module in python3.8
body: <p>I am trying to write a module in C++ and to compile it with mingw32 as an dynamic library to use it in Python.</p>
  
  <p><code>test.cpp</code></p>
  
  <pre class="lang-cpp prettyprint-override"><code>int square(int x)
  {
      return x * x;
  }
  </code></pre>
  
  <p>Compiling to dll:</p>
  
  <pre><code>g++ -c test.cpp -o test.o
  g++ test.o -shared test.dll
  </code></pre>
  
  <p>In the same directory, I have <code>test.py</code> where I want to call the function written in C++</p>
  
  <p><code>test.py</code></p>
  
  <pre class="lang-py prettyprint-override"><code>import os
  import ctypes
  from ctypes.util import find_library
  
  os.add_dll_directory(os.getcwd())
  print(os.getcwd())
  
  print(find_library("test.dll"))
  
  name = find_library("test.dll")
  lib = ctypes.cdll.LoadLibrary(name)
  lib.square(3)
  </code></pre>
  
  <p>As you can see, I have already tried to include my workspace directory to the DLL search path. However, the interpreter is still unable to find the module, I have also already tried to use only <code>"test"</code>. </p>
  
  <p>Output:</p>
  
  <pre><code>{workspacedirectory}
  test.dll
  Traceback (most recent call last):
    File "test.py", line 11, in &lt;module&gt;
      lib = ctypes.cdll.LoadLibrary(name)
    File "C:\...\Python\Python38\lib\ctypes\__init__.py", line 447, in LoadLibrary
      return self._dlltype(name)
    File "C:\...\Python\Python38\lib\ctypes\__init__.py", line 369, in __init__
      self._handle = _dlopen(self._name, mode)
  FileNotFoundError: Could not find module 'test.dll'. Try using the full path with constructor syntax.
  </code></pre>
  
  <p>So the line <code>find_library("test.dll")</code> is able to find the module, but it does not get found, when I want to load it.</p>