c++ - MFC DLL calls AfxWinInit and crashes application -
i have mfc .exe application, , created project dll mfc dynamically linked it.
now, when import dll through loadlibrary, crashes application, because when importing done, dll calls afxwininit().
should dll call afxwininit()? how avoid it? or else wrong?
in mfc application winmain() calls afxwinmain(). afxwininit() called @ beginning of afxwinmain(). initialization done framework you. there no need initialize again.
mfc dlls provide own entry point, you're not supposed write 1 yourself. if plan write dll mfc support, i'd suggest start fresh mfc dll created app wizard , move code there.
for mfc applications load extension dlls, use afxloadlibrary instead of loadlibrary.
Comments
Post a Comment