I’m using the Python ctypes library to call the LexActivator functions. I declare the string arguments as c_char_p and everything works fine in Linux. But in Windows, it cannot even find the Product.dat file. What is the correct way to call LexActivator.dll functions from Python 3? I tried c_wchar_p but that doesn’t seem to work either.
Okay, I figured out the problem. Three things:
- In Windows all strings must be c_wchar_p, while in Linux/Mac all strings must be c_char_p.
- Windows pathnames MUST include a drive letter.
- Backslashes must be doubled:
product_file_name = ctypes.c_wchar_p(‘C:.\\MyProduct.dat’)