⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cplusxtors.c

📁 VXWORKS源代码
💻 C
字号:
/* cplusXtors.c - run time support for static ctors and dtors *//* Copyright 1993 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01f,19mar02,sn   SPR 71699 - moved cplusXtorStrategy here from cplusUsr.o01e,21jan02,sn   combined with cplusGlob.cpp; made a 'C' file01d,16oct00,sn   use standard C++01c,03jun93,srh  doc cleanup01b,23apr93,srh  implemented new force-link/initialization scheme01a,31jan93,srh  written.*//*DESCRIPTIONThis module contains core run time support for static constructors anddestructors (cplusCallCtors/cplusCallDtors) as well as user-callablefunctions (cplusCtorsLink/cplusDtorsLink) which call staticinitializers for C++ modules that are linked with VxWorks.NOMANUAL*//* Includes */#include "vxWorks.h"#include "cplusLib.h"extern VOIDFUNCPTR _ctors[];extern VOIDFUNCPTR _dtors[];/* Globals */char __cplusXtors_o = 0;CPLUS_XTOR_STRATEGIES cplusXtorStrategy = AUTOMATIC;/******************************************************************************** cplusCtorsLink - call all linked static constructors (C++)** This function calls constructors for all of the static objects linked* with a VxWorks bootable image.  When creating bootable applications,* this function should be called from usrRoot() to initialize all static* objects.  Correct operation depends on correctly munching the C++* modules that are linked with VxWorks.** RETURNS: N/A*/BOOL linkedCtorsInitialized = FALSE;void cplusCtorsLink ()    {    if (!linkedCtorsInitialized)       {       cplusCallCtors (_ctors);       linkedCtorsInitialized = TRUE;       }    }/******************************************************************************** cplusDtorsLink - call all linked static destructors (C++)** This function calls destructors for all of the static objects linked* with a VxWorks bootable image.  When creating bootable applications,* this function should be called during system shutdown to decommission* all static objects.  Correct operation depends on correctly munching* the C++ modules that are linked with VxWorks.** RETURNS: N/A*/void cplusDtorsLink ()    {    cplusCallDtors (_dtors);    }/******************************************************************************** cplusCallCtors - call static constructors** This routine takes a <ctors> array, as generated by the munch utility,* and calls the function which is pointed to by each entry. Each function* in the <ctors> array calls the static constructors for one compilation* unit. The functions are called in the first-to-last order.** NOMANUAL*/void cplusCallCtors    (    VOIDFUNCPTR *ctors		/* array of pointers to ctor-calling functions */    )    {    /* call ctors in order */    VOIDFUNCPTR *pVFP;    for (pVFP = ctors; *pVFP != 0; pVFP++)	{	(**pVFP)();	}    }/******************************************************************************** cplusCallDtors - call static destructors** This routine takes a <dtors> array, as generated by the munch utility,* and calls the function which is pointed to by each entry. Each function* in the <dtors> array calls the static destructors for one compilation* unit. The functions are called in the last-to-first order, reversing* the order in which the static constructors were originally called.** NOMANUAL*/void cplusCallDtors     (    VOIDFUNCPTR *dtors		/* array of pointers to dtor-calling functions */    )    {    /* advance pVFP to end of dtors list */    VOIDFUNCPTR *pVFP;    for (pVFP = dtors; *pVFP != 0; pVFP++)	{	}        /* call dtors in reverse order of ctors */    while (pVFP > dtors)	{	(**--pVFP)();	}    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -