Код: Выделить всё
from functions_arrays import *
list1 = [0, 0, 0, 0, 0]
result1 = any_func(list1, len(list1))
print(f'list1: {list1}')
'''
# functions_arrays.py
def any_func(list_1, len_list_1):
for i in range(len_list_1):
list_1[i] = i
'''
Код: Выделить всё
# The next doesn't have the purpose to be exactly equivalent to the Python example above.
from ctypes import *
lib = CDLL("C:/any_folder/functions_arrays.dll")
lib.any_func.argtypes = POINTER(c_int16),c_size_t
lib.any_func.restype = None
array1 = (c_int16*5)()
result1 = lib.any_func(array1, len(array1))
print(f'array1: {list(array1)}')
'''
//functions_arrays.dll
__declspec(dllexport) void any_func(int16_t* array_1, size_t len_array_1)
{
int i;
for (i=0; i
Подробнее здесь: [url]https://stackoverflow.com/questions/79337059/getting-c-computing-speed-in-the-functions-side-ideally-w-o-much-refactorin[/url]