I have a problem executing 64-bit version of my program:
_XMLDoc = new TBasicXML(_owner);
try {
_XMLDoc->LoadFromFile(_filePath);
}
catch (...) {
delete _XMLDoc;
return "?";
}
In 32-bit version, when _filePath does not exist, program goes into catch block, but in 64-bit version it does not. Actually, it throws EDOMParseError several times and it enters catch block after I press continue for each error dialog.
TBasicXML class constructor is:
__fastcall TBasicXML::TBasicXML(TComponent *Owner, UnicodeString encoding)
{
_doc = new TXMLDocument(Owner);
_doc->Active = true;
_doc->Encoding = encoding;
_doc->Options = TXMLDocOptions()<<doNodeAutoIndent;
}
Is there something specifically I need to specify in project options for Win 64 target that defers from 32-bit target, to avoid such behavior?
Edit: I was focused on this part of code (parser), because it's executed at the program start. However, I've added this peace of code in my main form's constructor, before parser call:
int x;
try {
x = StrToInt("not a number");
}
catch (...) {
MessageDlg("Exception catched!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
I've built 64-bit release version and started the program (Run without debugger). It simply aborts without any message. When the same program (release) is started with debugger (Run (F9)) it shows error message dialog (EConverterError) and then after continue is pressed it shows my MessageDlg.
Note: with 32-bit version, there is no problem at all.
Edit2: I've test some other projects, the same situation:
__fastcall TfrmMain::TfrmMain(TComponent* Owner)
: TForm(Owner)
{
// test
int x;
try {
x = StrToInt("not a number");
}
catch (...) {
MessageDlg("Exception catched!", mtInformation, TMsgDlgButtons() << mbOK, 0);
}
//Ie settings
IEGlobalSettings()->AutoFragmentBitmap = false;
IEGlobalSettings()->MsgLanguage = msEnglish;
IEGlobalSettings()->EnableTheming = true;
// initialize spengine
speInit(); // delayed DLL load
FLeftId = 0;
FRightId = 0;
}
Again, 64-bit release version, when started from IDE, without debugger, silently terminates program, when started with debugger, works normally.
Edit3: Now, here is a mystery? From the example above, I've excluded DLL library (spEngine.a) from build and commented all code related to DLL entry calls and try-catch block works as usual. When spEngine.a is included, no matter if DLL loading (spEngine.dll) is delayed or not and without any call to DLL entries, try-catch block woks as previously described. Very strange. spEngine.dll calls custom Intel's ipp DLL build with MVSC2017. The similar try-catch behavior I have experienced with another library that calls OpenCV DLLs (wrapper built with MSVC2017). The complete source code is here: https://github.com/spetric/Lips
Note: 64-bit host application works well, no problems with functionality, only with strange try-catch block behavior.