![]() |
【转帖】dll crashes
dll crashes...
dll crashes... hi everyone, i'm using dwgdirect in a dll, and i'm having this problem: to create the graphical context on which to paint, i use this piece of code in the dll: ------------------------------------------------------------- m_pdevice = getrendererdevice(); if(m_pdevice.isnull()) return; m_hhelperdc = (hdc)hdc; odrxdictionaryptr pproperties = m_pdevice->properties(); pproperties->putat("windowhdc", odrxvariantvalue(hdc)); if(pproperties->has("doublebufferenabled")) { pproperties->putat( "doublebufferenabled", odrxvariantvalue(doublebufferenabled())); } m_pdevice->setbackgroundcolor(activebackground()); m_pdevice->setlogicalpalette(curpalette(), 256); if( !database() ) return; int n = m_pdevice->numviews(); m_pdevice = oddbgsmanager::setupactivelayoutviews(m_pdevice, this); setviewportborderproperties(m_pdevice, true); ------------------------------------------------------- where hdc is the hdc passet to the dll by the client application. the problem is: when the dll is unloaded, i use this function: ------------------------------------------------------------------- int crendererdllapp::exitinstance() { m_pdb = null; if(m_gsmoduleid) { m_pgs.release(); :drxdynamiclinker()->unloadmodule(m_gsmoduleid); m_gsmoduleid = 0; } :duninitialize(); return cwinapp::exitinstance(); } --------------------------------------------------------------------- and here everything seems to be ok, but, in the client application everything crashes in this piece of mfc code: afxgetmodulestate()->m_bdll any idea about the reason ???? my dll is a mfc dll with mfc dynamically linked, in the exported funcions of the dll i put the afx_manage_state(afxgetstaticmodulestate()); macro. |
所有的时间均为北京时间。 现在的时间是 10:36 AM. |