diff options
| author | liuxianliang <[email protected]> | 2021-04-06 10:42:58 +0800 |
|---|---|---|
| committer | liuxianliang <[email protected]> | 2021-04-06 10:42:58 +0800 |
| commit | 233e1cd8bc7cbdc38006dfc18adde8bc2595620f (patch) | |
| tree | cec4669f56b09734b7dcc2682d854fef325722b8 /include/rtdef.h | |
| parent | 4431c4796fb3e26fb66c012feb8bf47f3292b473 (diff) | |
| parent | c5a0df2254bd6fadc941a33d9066ce6b972c4274 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into develop_one
Diffstat (limited to 'include/rtdef.h')
| -rw-r--r-- | include/rtdef.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/include/rtdef.h b/include/rtdef.h index b936a33455..b368208175 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -210,7 +210,32 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #ifdef RT_USING_COMPONENTS_INIT typedef int (*init_fn_t)(void); #ifdef _MSC_VER /* we do not support MS VC++ compiler */ - #define INIT_EXPORT(fn, level) +#pragma section("rti_fn$f",read) + #if RT_DEBUG_INIT + struct rt_init_desc + { + const char* level; + const init_fn_t fn; + const char* fn_name; + }; + #define INIT_EXPORT(fn, level) \ + const char __rti_level_##fn[] = level"__rt_init_"#fn; \ + const char __rti_##fn##_name[] = #fn; \ + __declspec(allocate("rti_fn$f")) \ + RT_USED const struct rt_init_desc __rt_init_msc_##fn = \ + {__rti_level_##fn, fn, __rti_##fn##_name}; + #else + struct rt_init_desc + { + const char* level; + const init_fn_t fn; + }; + #define INIT_EXPORT(fn, level) \ + const char __rti_level_##fn[] = level"__rt_init_"#fn; \ + __declspec(allocate("rti_fn$f")) \ + RT_USED const struct rt_init_desc __rt_init_msc_##fn = \ + {__rti_level_##fn, fn }; + #endif #else #if RT_DEBUG_INIT struct rt_init_desc |
