I'm trying to call a function in a DLL using Python 3.8 with the ctypes module.
The function name in the DLL is __apiJob(). Pay attention, this function starts with a double underline.
I want to call it in a self-defined object like:
class Job:
def __init__(self,dll_path):
self.windll = ctypes.WinDLL(dll_path)
def execute(self):
self.windll.__apiJob()
a = Job('api64.dll')
a.execute()
But as the function name starts with double underline, with the name mangling function in Python, it will be regarded as a private method. Therefore, when running this script, the __apiJob will be renamed to _Job_apiJob which results in an error: "_Job__apiJob" not found.
How can I deal with situation?