what are the differences among the ways to access msvcrt in python on windows?

839 views Asked by At

on windows, what is the difference among the following?

import msvcrt as x

vs

x = ctypes.cdll.msvcrt

vs

x = ctypes.CDLL(find_library('c'))

vs

x = ctypes.CDLL(ctypes.util.find_msvcrt())

i believe the doc say the last two are equivalent. but the first two are never (clearly) documented, and seem strictly better. for instance, when running python from some other context that uses a different msvcr*.dll (eg, matlab), replacing the third with the second solved this bug.

0

There are 0 answers