Theoretical Basis:
1. The C ++ Runtime Library for Windows is divided into two types: multi-threaded and multi-threaded DLL. The former is a static library and will be linked to the targetProgramThe latter is a dynamic link library, which is dynamically loaded when the target program is running.
2. Windows heap memory is divided into two types: Default heap and private heap. By default, the heap can be accessed across modules in the same process, while the private heap can only be accessed in the module.
3. The CRT function in the C ++ Runtime library uses the new operator or the malloc function to allocate memory. Both of them call the heapalloc API on the private stack named _ crtheap for memory allocation.
It can be seen that the multi-threaded DLL program can safely pass STL parameters across modules, because all memory allocation is in the DLL module; the multi-threaded program can only pass the memory address on the default stack.