C++ exception on Vista when using ROOT compiled with VC 9.0

Dear ROOTers,

After successfully compiling ROOT on Windows Vista with VC 9.0 (Visual Studio Express Edition 2008)
I could also successfully compile my library. For compiling my library I used the Makefile.win:
a, with option /MT
b, with option /MD

When running my library compiled with option /MT I get the following error:

C:\home\Rabbitus\ROOT\rootcode\xps-x.x.x>root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.24/00      29 June 2009   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.24/00 (trunk@29257, Jun 30 2009, 09:23:51 on win32)

CINT/ROOT C/C++ Interpreter version 5.17.00, Dec 21, 2008
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L macroTest4XPS.C
root [1] Init("C:/home/Rabbitus/ROOT/rootcode/xps-x.x.x/src/xps.dll")
root [2] ImportDataTest3("tmp_DataTest3", "C:/home/Rabbitus/CRAN")
---XManager::XManager------
---XDataManager::XDataManager------
------XManager::SetMaxFileSize------
------XManager::Initialize------
------XDataManager::NewSetting------
---XSetting::XSetting------
---XDataSetting::XDataSetting------
------XDataManager::InitDefaults------
------XDataManager::InitInput------
------XDataSetting::InitInput------
schemename=
fNVar= 1
*fVars= 00000000
*fTyps= 00000000
*fVars= 05212D7C
*fTyps= 05212D94
fVars[0]= *
fTyps[0]= *
------XDataManager::InitInput------
------XDataSetting::InitInput------
schemename= Test3
fNVar= 3
*fVars= 00000000
*fTyps= 00000000
*fVars= 0521DFA4
*fTyps= 0521DFCC
Error: C++ exception caught C:\home\Rabbitus\ROOT\rootcode\xps-x.x.x\macroTest4XPS.C(47)
(Int_t)0
*** Interpreter error recovered ***
root [3] .q
Warning in <TWinNTSystem::Run>: handle uncaugth exception, terminating

C:\home\Rabbitus\ROOT\rootcode\xps-x.x.x>

The C++ exception error occurs on line 47 of macroTest4XPS.C:

   manager->InitInput("Test3","cel","MEAN/D:STDV/D:NPIXELS/I","RawData");

Here is the source code with debug info for the corresponding function:

Int_t XDataSetting::InitInput(const char *schemename, const char *datatype,
                    const char *varlist, const char *inputtype)
{
   // Initialize input data with schemename being exact name of array type
   // datatype should describe type of chip data, e.g. cel for rawdata,
   // tbw, mdp for Metrics or PivotData (but also mas5 or rma)
   // varlist is list of variables to be stored in tree(s) and should contain
   // type of variable, e.g. "var1/I:var2/C:var3/D"
   // inputtype is rawdata (default), Metrics, PivotData
   if(kCS) cout << "------XDataSetting::InitInput------" << endl;

   fSchemeName = schemename;
   fDataType   = datatype;
   fInputType  = inputtype;
 cout << "schemename= " << schemename << endl;

   fNVar = NumSeparators(varlist, ":") + 1;
 cout << "fNVar= " << fNVar << endl;
   if (fVars) {delete [] fVars; fVars = 0;}
 cout << "*fVars= " << fVars << endl;
   if (fTyps) {delete [] fTyps; fTyps = 0;}
 cout << "*fTyps= " << fTyps << endl;

//   if (!(fVars = new (nothrow) TString[fNVar])) return errInitMemory;
//   if (!(fTyps = new (nothrow) TString[fNVar])) return errInitMemory;

 if (!(fVars = new TString[fNVar])) return errInitMemory;
 cout << "*fVars= " << fVars << endl;
 if (!(fTyps = new TString[fNVar])) return errInitMemory;
 cout << "*fTyps= " << fTyps << endl;

   for (Int_t i=0; i<fNVar; i++) {
      fVars[i] = SubString(varlist, ":", i);
      fTyps[i] = Path2Name((fVars[i]).Data(),"/","");
      if (fTyps[i] == "") fTyps[i] = "D";
      fVars[i] = Path2Name((fVars[i]).Data(),"","/");
   }//for_i
 cout << "fVars[0]= " << fVars[0].Data() << endl;
 cout << "fTyps[0]= " << fTyps[0].Data() << endl;

   return errNoErr;
}//InitInput

As you see, the C++ exception occurs when trying to create "fVars = new TString[3]"
but not earlier when creating “fVars = new TString[1]”.

In contrast, when running my library compiled with option /MD everything is fine:

C:\home\Rabbitus\ROOT\rootcode\xps-x.x.x>root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.24/00      29 June 2009   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.24/00 (trunk@29257, Jun 30 2009, 09:23:51 on win32)

CINT/ROOT C/C++ Interpreter version 5.17.00, Dec 21, 2008
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L macroTest4XPS.C
root [1] Init("C:/home/Rabbitus/ROOT/rootcode/xps-x.x.x/src/xps.dll")
root [2] ImportDataTest3("tmp_DataTest3", "C:/home/Rabbitus/CRAN")
---XManager::XManager------
---XDataManager::XDataManager------
------XManager::SetMaxFileSize------
------XManager::Initialize------
------XDataManager::NewSetting------
---XSetting::XSetting------
---XDataSetting::XDataSetting------
------XDataManager::InitDefaults------
------XDataManager::InitInput------
------XDataSetting::InitInput------
schemename=
fNVar= 1
*fVars= 00000000
*fTyps= 00000000
*fVars= 03B2AEAC
*fTyps= 03BF4A74
fVars[0]= *
fTyps[0]= *
------XDataManager::InitInput------
------XDataSetting::InitInput------
schemename= Test3
fNVar= 3
*fVars= 00000000
*fTyps= 00000000
*fVars= 03CA684C
*fTyps= 03CA689C
fVars[0]= MEAN
fTyps[0]= D
------XDataManager::New------
------XManager::New------
------XManager::NewFile------
Creating new temporary file <C:/home/Rabbitus/CRAN/tmp_DataTest3_cel.root>...
...
...

Please note that on Windows XP it does not matter whether I use option /MT or /MD to compile my library,
both options work equally well.

Do you know what might be the reason for the C++ exception on Windows Vista?

Best regards
Christian

Hi Christian,

This is very weird, I don’t expect any difference between XP and Vista… I’ll try as soon as I’m back at work (mid October)

Cheers, Bertrand.

Dear Bertrand,

Did you have already time to look at this problem?
I know that it is related to the other problems but this is the first concrete error I could detect.

Best regads
Christian

Hi Christian,

See: root.cern.ch/phpBB2/viewtopic.php?t=9182

Cheers, Bertrand.