RE: [ROOT] How to use third party's shared library in Root/Cint

From: HP Wei (hp@rentec.com)
Date: Wed Aug 02 2000 - 22:18:56 MEST


I want to thank Philippe and Fons for helping out.
Now, the problem is solved.
HP 

ps:
Here is the summary of the process 
for the benifit of those who may
want to do the same job.

The objective is to use commercial C shared library in cint enviornment.
In this case, the library is in the form of binary shared libraries
(libeng.so and others under Sun's Solaris) 
and C header files (the main one being engine.h). 
No source codes are available.
We want to be able to manipulate these C functions and structures in
CINT.  

Steps:
(1) Create a file called (e.g.) engLinkDef.h, in which we
    tell CINT what functions and enum's that we would like to use in CINT.
  
  ------examples:-------  
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C function engOpen;
#pragma link C enum mxClassID;

#endif

(2) rootcint engDict.C -c -p engine.h engLinkDef.h
    I am using Root system 2.25. the output of the above command is:
    
Note: operator new() masked 1c
Note: operator delete() masked 1c

    Then, this generates two files: engDict.C engDict.h
    
(3) compile engDict.C into engDict.o
(4) compile myroot.C into myroot.o
    here myroot.C is:

#include "TROOT.h"
#include "TRint.h"

TROOT root("Rint","The ROOT Interactive Interface");

int main(int argc, char **argv)
{
   TRint *theApp = new TRint("Rint", &argc, argv, 0, 0);
   // Init Intrinsics, build all windows, and enter event loop
   theApp->Run();

   delete theApp;

   return(0);
}

(5) Link together myroot.o and engDict.o
    (one of the link flag should be -L/shared_library_path -leng ...)
    
(6) in the custom CINT (myroot),
    we can now call those functions in the shared library.
    
-----------------------------



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:30 MET