I'm trying to execute a dll from python.
I found this code
# Importamos ctypes
import ctypes as c
# acceso a la biblioteca
dll = c.CDLL("funciones.dll")
# acceso a la variable global de la biblioteca
# longitud del array
size = c.c_int.in_dll(dll, 'tam').value
# se establece el tipo de dato (en C) que retornará la función
dll.promedio.restype = c.c_float
# de esta forma se declara un array de enteros con ctypes
vector = c.c_int * size
# se define al array
v = vector(10,20,13,14,5,16)
When I run the program, it tells me:
OsError [WinError 193] %1 no es una aplicación WIN32 válida.
I was looking in the forums and indicated that the problem may be that I'm trying to run a 32-bit dll in 64 python.
So, since I was using Python 64, I switched to 32-bit python and it does not work either.
Now. The strangest thing is that if I execute the python interpreter and I am executing instruction by instruction, the program works and does not mark error; it only does it when the .py file.
Will anyone know anything about it?
Greetings!