Compiling root classes into MSVC MDI?

Pasha Murat (murat@cdfsga.fnal.gov)
Mon, 29 Sep 1997 21:56:17 GMT


Sorry for being ignorant - I dont' know what MSVC MDI is,
however the example below (made from your one) works just fine
on SGI IRIX 6.2 with gcc-compiled ROOT.
You may want to try it,
Pasha
-------------------------------- test002.hh
#include "Rtypes.h"

class TEST {
int a;
public:
TEST() {};
~TEST() {};
int test();
ClassDef(TEST,1)
};

#ifdef __CINT__
#pragma link C++ class TEST;
#endif
---------------------------------------- test002.cc
#include "test002.hh"
ClassImp(TEST)
int TEST::test() {
char *text = new char[100];
delete[] text;
}
---------------------------------------- LinkDef.h
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#endif
---------------------------------------- Makefile
>rootcint -f test002_cint.cc -c -I$ROOTSYS/include -I$tdr/include \
>inc/LinkDef.h test002.hh
>gcc -shared -o test002.so -I$ROOTSYS/include -I$tdr/include test002_cint.cc \
>test002.cc
--------------------------------------------------------------------------------
>root
/cdf/upgrade/tracking/murat/test_root>root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 1.03/03 29 September 1997 *
* Development version *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************

CINT/ROOT C/C++ Interpreter version 5.13.28, Sep 23 1997
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] gSystem->Load("test002.so")
(int)0
root [1] TEST a;
root [2] a.test()
(int)0
root [3] .q
--------------------------------------------------------------------------------

William J. Deninger writes:
> Hello!
>
> I have a MSVC++ multiple document interface circuit code application
> I've written during the past eight weeks before stumbling upon ROOT.
> Now I seem to have a serious dilemma. Is it reasonably possible to
> incorporate ROOT plotting classes (THxx, TNtuble, etc.) into an MFC
> application? Or would you believe less time consuming to convert
> existing MSVC document and view classes to ROOT? For the later case,
> take into consideration that I've used STL deque containers.
>
> I've already tried calling root routines from my applications, but the
> root library "new" and "delete" overloading seems to crash my program.
> // Sample
> // any MSVC class within MDI application with ROOT_xxx libs included in
> link
> void TEST::test()
> {
> char *text = new char[100];
> delete[] text; // generates Runtime abnormal termination error
> }
> "char" infact is just an example. Any data type/class will result in
> the same error
>
> William J. Deninger
> deninger@uiuc.edu
>
>
>