Re: CString Format causes memory issue
Okay...I figured out how to set compiler / linker options and was able
to debug the code. I found the line it crashes on.
I am using an extension DLL, and it crashes on a function call to the
DLL. FYI, I have to link to MFC Statically because of the extension
dll. Here is the code:
CString titleStr;
GetProfileGraphTitle(2,titleStr); //Crashes here!
CString GraphTitle = titleStr.GetBuffer(0);
The function is in my DLL. Here is the prototype and function:
__declspec(dllexport) void GetProfileGraphTitle(int num,CString &str);
void GetProfileGraphTitle(int num,CString &str) {
if(num >= 0) str = ProfileGraphs[num].GraphTitle;
}
The ProfileGraphs variable is a structure defined as follows:
ProfileGraphData ProfileGraphs[NUM_PROFILE_GRAPHS];
struct ProfileGraphData {
CString GraphTitle;
CString ShortTitle;
BOOL IsSelected;
int Xunits; //type of X units
int Yunits; //type of Y units - in user defined graphs this is the
units selected by the user
int NumCurves;
int NumPoints;
DynamicCurve theData[MAX_PROFILE_CURVES];
float MaxY;
float MinY;
float UserMaxY;
float UserMinY;
BOOL UseDefaults;
float IgnoreLimit;
int StartAvg;
int EndAvg;
//only for user defined graphs
int GraphType[MAX_PROFILE_CURVES];
int ParamType;
int CurveNum[MAX_PROFILE_CURVES];
int FileYUnits;
int ParamNumber;
};
#define MAX_PROFILE_CURVES 50
#define NUM_PROFILE_GRAPHS 50
Is there anything that you can think of that may be wrong? Or a place
to start? Thanks!!
Jen