K
Konark Khera
While Loading the data from "CArchive >> Operator" my application crashes.
Following is the class hierarchy of my application, and the various things
that i debugged:
Class B is the base class and there are two classes derived from it Class D1
and Class D2.
I serialze the data of class D1 through the "CArchive << operator" and when
i try to load it through the "CArchive >> operator" it fails.
When we save the data through CArchive << operator, it stores the class name
i.e D1 before the member variables of this class that we serialized, so that
when we load it, it should be able to create the object of classD1 and would
be able to retrieve the data.
I debugged the following and found out that there is an AFX_MODULE_STATE of
the application that stores all the runtime classes of the application. The
CArchive >> operator reads the class name and matches it with all the
runtime classes present in AFX_MODULE_STATE application pointer. The
AFX_MODULE_STATE pointer of my application did not have any runtime classes
in it and that is why it failed.
When I debugged further, I found that if I load an Extension Dll at runtime
through LoadLibrary it corrupts the module state of my application and if I
try to retrieve the data after that, my application crashes.
Has anyone of you faced a similar kind of a problem. The same scenario works
fine in VC6.
Can anyone help me on this,
Thanks,
Konark
Following is the class hierarchy of my application, and the various things
that i debugged:
Class B is the base class and there are two classes derived from it Class D1
and Class D2.
I serialze the data of class D1 through the "CArchive << operator" and when
i try to load it through the "CArchive >> operator" it fails.
When we save the data through CArchive << operator, it stores the class name
i.e D1 before the member variables of this class that we serialized, so that
when we load it, it should be able to create the object of classD1 and would
be able to retrieve the data.
I debugged the following and found out that there is an AFX_MODULE_STATE of
the application that stores all the runtime classes of the application. The
CArchive >> operator reads the class name and matches it with all the
runtime classes present in AFX_MODULE_STATE application pointer. The
AFX_MODULE_STATE pointer of my application did not have any runtime classes
in it and that is why it failed.
When I debugged further, I found that if I load an Extension Dll at runtime
through LoadLibrary it corrupts the module state of my application and if I
try to retrieve the data after that, my application crashes.
Has anyone of you faced a similar kind of a problem. The same scenario works
fine in VC6.
Can anyone help me on this,
Thanks,
Konark