Today, I encountered a very strange problem. It was developed based on MFC in vs2005. Program If you place the implement_dyncreate macro at the beginning of the CPP file, there are a bunch of errors during the runtime, but there is no problem if you put the macro at the end of the CPP file. What's more interesting is that if you want to place this macro in the file header, but it cannot appear in the form of a macro, you must expand it. We know that in MFC, implement_dyncreate is defined: # Define Implement_dyncreate (class_name, base_class_name )/ Cobject * Pascal class_name: Createobject ()/ {Return NewClass_name ;}/ Implement_runtimeclass (class_name, base_class_name, 0 xFFFF ,/ Class_name: Createobject, null) I expanded this macro in the CPP file header: Cobject * Pascal cmyclass: Createobject () {Return NewCmyclass ;} Implement_runtimeclass (cmyclass, cbaseclass, 0 xFFFF ,/ Cmyclass: Createobject, null) Everything is OK, and the operation is normal !! Incredible !!!! It is estimated that it is related to the compiler because MFC Code This macro appears at the end of the file. A # Ifdef Afx_init_seg # Pragma code_seg (afx_init_seg) # Endif Such a thing. However, it may also be because of a problem with the self-compiled MFC library. Thinking ...............