I called the DLL file in Blender's Python script then blender crash

The DLL file is written in C++. Some of the class methods in it have threads enabled and some call Real Sense camera. Then, the interface is written in Python C and invoked by Blender’s Python code.

However, as long as the class method containing thread in DLL is called, blender will crash; When calling the class method with real sense camera API, an error will be reported: realsense error calling RS2_ pipeline_ start_ with_ config()

Please tell me why? Thank you very much!!

I wrote a plug-in in blender in Python, wrote an interface through Python C API, used it as a bridge and called DLL. The DLL can be called normally by the plug-in.
but when the method in the DLL uses multithreading, the plug-in calls it, and the blender will crash.

I have tried blender 2.8.3 (Python 3.7) and blender 2.9.3 (Python 3.9), and the results are the same

There isn’t very much here to work with, it essentially boils down to “I wrote code, it crashes, why?” which is near impossible to answer.

Your best bet would be loading blender up in the debugger and investigating the crash.

When multithreading is used in a DLL, is Blender’s plug-in not allowed to call this DLL?

Threading is allowed, no problem, many 3rd party render engines use it for instance.

thread = std::thread(& {}); As long as there is such code in the DLL, it will crash after blender invoke the DLL

I suggest you attach a debugger, and figure out why

OK, thank you very much