1
0
Эх сурвалжийг харах

[libc][cpp] 增加 cxx_crt_init.c 函数注释 (#7535)

Mengxi-Xu 1 жил өмнө
parent
commit
1e5dc5509e

+ 12 - 0
components/libc/cplusplus/cxx_crt_init.c

@@ -34,6 +34,18 @@ rt_weak void *__dso_handle = 0;
 
 #endif
 
+/**
+ * @brief   This function initializes the C++ runtime environment for ARM and GCC compilers.
+ *
+ * @note    If there is no SHT$$INIT_ARRAY section, calling $Super$$__cpp_initialize__aeabi_() will cause an error
+ *          in ARMCC compiler. Therefore, this function manually iterates through the base addresses of the
+ *          SHT$$INIT_ARRAY section to call the constructor functions of each object. In GCC compiler, this function
+ *          uses the __ctors_start__ and __ctors_end__ global variables to determine the range of constructor function
+ *          pointers and calls each constructor function of every object in that range.
+ *
+ * @return  Returns 0 if the initialization of the C++ runtime environment is successful. Otherwise, it returns
+ *          an error code indicating the failure of the operation.
+ */
 rt_weak int cplusplus_system_init(void)
 {
 #if defined(__ARMCC_VERSION)