Вот мой " Библиотека классов":
Код: Выделить всё
using System;
using System.Runtime.InteropServices;
namespace DLLTest
{
[ComVisible(true)]
public class Class1
{
public int add(int n1, int n2)
{
return n1 + n2;
}
}
}
Код: Выделить всё
from ctypes import *
mydll = cdll.LoadLibrary(r'C:\DLL path\mydll.dll')
result = mydll.add(3,5)
print(result)
Код: Выделить всё
Traceback (most recent call last):
File "C:\Programs\Python\Python37-32\test_dll.py", line 5, in
result = mydll.add(3,5)
File "C:\Programs\Python\Python37-32\lib\ctypes\__init__.py", line 369, in
__getattr__
func = self.__getitem__(name)
File "C:\Programs\Python\Python37-32\lib\ctypes\__init__.py", line 374, in
__getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'add' not found
Большое спасибо
Подробнее здесь: https://stackoverflow.com/questions/667 ... rom-python