关于main函数的奇怪问题
这是一个main函数,但是奇怪的是,我加上exit,函数直接退出,没有问题;但是不加exit,单步调试,走到return 0后,竟然有跳到了main的开头执行,导致异常,请问这个是什么原因??
int main(int argv,char** args)
{
std::string strDLLPath = "D:\\server\\Debug\\tk.dll";
ACE_DLL *m_pAceDll = new ACE_DLL;
int errorCode = m_pAceDll->open(strDLLPath.c_str());
if(0 != errorCode)
{
cout<<"Fail to open the dll file!"<<endl;
exit(0);
}
void* funcPointer = m_pAceDll->symbol("createDllInterface");
ErrorCode (*createInterface)(CDllInterface*&) = (ErrorCode(*)(CDllInterface*&))funcPointer;
ErrorCode returnValue = createInterface(m_dllInterface);
if (0 == returnValue)
{
m_dllInterface->initializeDll();
m_dllInterface->finalizeDll();
}
m_pAceDll->close();
ACE_OS::_exit();//没有这句,main函数执行完return,竟然有跳到了函数的开头??!!
return 0;
}