Python Forum

Full Version: ctypes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how can I declare using ctypes where my DLL file is located.?

this line gives me an error
OSError: [WinError 193] %1 is not a valid Win32 application

pd = ctypes.WinDLL("C:\\APAS_ATE\\Arinc429_RTX\\APISPA.dll")
What is APISPA.dll?
(Apr-19-2023, 05:42 PM)deanhystad Wrote: [ -> ]What is APISPA.dll?

it is a DLL provided by the manufacturer of an electronic module I need to use to transmit some sort of avionic protocol named ARINC429.
they say this DLL can be used by any windows language including Python,
once the library be installed I'm suppose to use the function for that electronic module
The error indicates the DLL is of the wrong type. When it can't find the DLL ther error is "The specified module could not be found".

Do they have multiple DLL's? Maybe they have a 32 bit and a 64 bit version? Is it this "http://www.rtxsystems.com/SPA.html"? Looks like something I would use with DOS on my vintage 396 computer.

Are they aware there is a Python newer than 2.7? Windows Python requires dll's written using a Visual Studio compiler that is compatible with the Visual Studio used to compile Python. Maybe you need to compile the DLL code.
no, in the CD only found out...

APISPA.dll
APISPA.c
APISPA.h

do you think this DLL is 32 bits and my system is 64?
Is this DLL registered on the system in the first place, e.g. during install of some software or via regsrv32?
Any readme.txt on the CD? The website is not a fountain of information.
There is a conversion package for that format

PiPy: https://pypi.org/project/arinc424/
GitHub: https://github.com/jack-laverty/arinc424

I've never used it, so can't vouch for it, But i expect it's worth trying.