Answer the question
In order to leave comments, you need to log in
How to use ctypes, c++ and python?
Understanding the ctypes tool to call dll from python code. It is not possible to call functions from a dll compiled from C ++, although the same source code, but already in C, compiled into a dll, works fine, all functions are called.
C/C++ code:
int test(int x)
{
return x;
}
Python code:
from ctypes import *
c_testlib = cdll.LoadLibrary('libtest.dll')
c_test=c_testlib.test
Error:
AttributeError: function 'test' not found
Are Ctypes and C++ not friends? What are the options for calling functions from already written dlls in C++?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question