We have "in house" XLL libraries that we make for Excel. Assuming we match the 32-bit/64-bit ness between the XLL and python, can we use ctypes to load and use the XLL (treating it as a DLL)?
Has anybody done this? Any known issues and work arounds?
Edit: I tried doing this and no luck so far. The Excel add-on works on 32-bit excel, so I figured it was a 32 bit library.
lib = ctypes.CDLL(xll)
In 64 bit python, I get
c:\anaconda3\envs\py38\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
371
372 if handle is None:
--> 373 self._handle = _dlopen(self._name, mode)
374 else:
375 self._handle = handle
OSError: [WinError 193] %1 is not a valid Win32 application
In 32 bit python, I get:
c:\Anaconda\envs\py39_32\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
380
381 if handle is None:
--> 382 self._handle = _dlopen(self._name, mode)
383 else:
384 self._handle = handle
FileNotFoundError: Could not find module 'C:\public\ExcelAddons\alib.0.86\alib.xll' (or one of its dependencies). Try using the full path with constructor syntax.