- Use Python to call C++'s dll dynamic link library record : on Windows
- First use C++ to generate a dynamic link library (see the two videos together, each has its own advantages): Simple use of C/C++ dynamic link library-01_哔哩哔哩_bilibili , Visual Studio 2019-write C++ dynamic link library_哔哩Bilibili_bilibili
- The next step is to use Python to call this library: third-party applications call DLL-Python calls C++ dynamic library_哔哩哔哩_bilibili
- He didn't encounter that C++ is of string type. I want to pass in a string file address string, but Python does not have it, and there is no corresponding one with ctypes, so I found a conversion method: first, change the parameters passed in C++ to into const char* str, and then use vc_func.argtypes = [POINTER(c_char), ctypes.c_float] in Python to set the format of the input parameter , the key point is: msg = bytes("hello world", "gbk") use this Change the format of the sentence, and then pass ret = vc_func(msg, 0.4); related links: Python calls C++ dynamic library several common usage methods_J ..'s blog-CSDN blog_python calls C++ dynamic library , how to convert char array string-C#.Net Tutorial-PHP Chinese Network can be completed with the second code.
- Using 3.7 on my computer can be adjusted. The teacher uses Python3.8 to call the dll and says that it cannot find the Could not find module . one of its___Watson__'s blog-CSDN blog_python3.8 dll
- Correspondence between variables and c in python ctypes module - Programmer Sought
Record the dll dynamic link library record of using Python to call C++ in the windows environment:
Guess you like
Origin blog.csdn.net/qq_37248679/article/details/127949516
Recommended
Ranking