Re: Compiling root classes into MSVC MDI?

Valery Fine (fine@mail.cern.ch)
Tue, 30 Sep 1997 10:05:33 +0100


On 29 Sep 97 at 18:26, William J. Deninger wrote:

> Oops! I'm sorry for not being more explicit. MSVC means Microsoft
> Visual C++, and MDI means Multiple Document Interface. The most
> immediate obstacle to incorporating the ROOT classes into my
> application, however, doesn't reside in calling functions or
=============
> instantiating ROOT classes.

Here is your mistake (see below).

> It comes with linking to the ROOT
> libraries. Even if I don't have any references to ROOT in my
> program, the ROOT library RTTI overloading of new and delete seem
> to be (perhaps) interfering with the Microsoft RTTI implemented in
> Multiple Document Interface applications, ... or the ROOT library
> new and delete overloads are simply not compatible with what Bill
> Gates wants. :)
>
> Is there anyone out there in Root Land knowledgeable in Microsoft
> Visual C++ programming and ROOT? Is it futile to try to merge the
> two?

My guess it has nothing with MSVC and its MDI interface at all.
The ROOT delete and new NEED the TROOT global object. So try to
introduce it somehow for your code and then try again

#include "TROOT.h"

. . .

TROOT GlobalRoot("RootRoot", "This is to make ROOT happy");

. . .

If you will create a DLL with your example and load it with ROOT
as Pasha Murat offered it will work, since that global TROOT is
supplied by ROOT package itself.

I think this helps (I mean new/delete interruption) to make a next
step but probably you'll stick with a next one namely with the
"Message event loop" supplied by MS Studio. Dont' forget ROOT has its
own Event Loop inside. To manage your (MDI) one, you are required
(very likely) to create a separate thread in your application first.

Anyway if you has spent 8 weeks only (?) probably you should
regard switching to ROOT completely (depends your task of course).

Ones upon a time I was thinking to use MFC but failed (taking in
account cross-platform issue). It was more easy to write everything
ourselves. I say it can be done, the question is whether it worth
(at the moment at least).

With my best regards,
Valery

Dr. Valeri Faine (Valery Fine)
------------ ------------- Phone: +41 22 767 4921
CERN FAX : +41 22 767 7155
CH-1211 Geneva, 23 mailto:fine@mail.cern.ch
Switzerland http://nicewww.cern.ch/~fine