Re: Root and MSVC++

From: Valery Fine (fine@bnl.gov)
Date: Thu Oct 01 1998 - 01:17:11 MEST


On 30 Sep 98 at 11:39, S.P. Wakely wrote:


> 
> I apologize for not being more explicit.
> 
> Yes.  The test\Makefile programs all compile.
> 
> Vlazy and Tcollex crash with page faults in <unknown> at
> 0084:80000000 and 0084:00000009, respectively.
> 
> hworld.exe crashes 80% of the time with a page fault in
> ROOT_GPAD.dll at 0137:008cf2d6 
> 

  This sounds like you have "strange"  version MSVC DLL on your path.

  Does the root/tutorial/benchmarks.C work  properly ?

> 
> Now I add a button to the dialog and add a function to handle the
> button click:
> 
> void CRootTestDlg::OnButton1(){
>   TROOT mytest("mytest","Test of Root + MSVC");
>   TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400);
> }
> 

  Here there are TWO major things to call your attention:

   1. Each application MUST be in possession of ONLY instance of TROOT 
      class. That's why  all our examples have TROOT as a global one.
 
      So please create TROOT mytest out of the OnButton1() function.
      I would advice to make it global one.

  2. The methods On<...> are to be call from within Windows 
     procedures which the TCanvas objects are not aware about. You 
     should create the ONLY instance of the TApplication first (see 
     hword.cxx example). The class will create the thread and event 
     loop to create canvases. That's why the object of this class 
     should be done at once and out of scope of the any On< . .  . > 
     method.

  So you should provide somewhere and at once:

     TROOT mytest("mytest","Test of Root + MSVC");   
and 
     TApplication theApp("App", &argc, argv);

  after that I hope you will be able to create TCanvas as follows:

   void CRootTestDlg::OnButton1(){
        TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400);
   }


  I'd like to call your attention the ROOT uses the stdin/stdout C 
I/O to supply the error and warning messages. This means you should 
create the WIN32 console to watch them.

  That's why you should they to create a DLL with 
your CRootTestDlg. let's say CRootTestDlg.DLL  load it into the ROOT 
session.

 c:>  root.exe   
 root [0] gSystem.Load("CRootTestDlg.DLL")
 root [1] CRootTestDlg newdialog;

  This way your class may not worry about TROOT and TApplication 
instance since they are provided by ROOT itself.

=================================================================
Dr. Valeri Faine (Fine)
    -------------------          Phone: +1 516 344 7806
Brookhaven National Laboratory   FAX  : +1 516 344 4206
Bldg. 510A /STAR                 mailto:fine@bnl.gov
Upton, New York, 11973-5000      http://nicewww.cern.ch/~fine
USA
                                 
Dr. Valery Fine                  Telex : 911621 dubna su
    -----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region      Fax   : +7 09621 6 51 45
Russia                           mailto:fine@main1.jinr.dubna.su                              



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:38 MET