0

I would like to use a C++ API from python. The files that I have are XX.dll, XX.lib and XX.h

The only info that I have are :

Notes: To use the XX functions inside your C++ project you must integrate the XX Object file library "XX.lib" and XX header file "XX.h". The XX DLL must be add in your computer environment but not necessarily in the same folder of the Visual Studio project.

Naively I tried to take the .dll and to use ctypes.cdll.LoadLibrary("XX.dll") but when I do that python tries (and fails) to load mscvr90.dll.

I think the problem with mscvr90.dll is related to https://stackoverflow.com/a/27392347/12452727 but I don't know how to solve it

Sylvain
  • 16
  • 3

1 Answers1

0

I found a quick fix. Apparently, the idea is to use "mt.exe" to incorporate a manifest in the dll.

The manifest "XX.dll.manifest"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
    </dependentAssembly>
  </dependency>
</assembly>

And the command needed is mt.exe -manifest XX.dll.manifest -outputresource:XX.dll;2

Sylvain
  • 16
  • 3