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

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Aug 01 2000 - 16:58:22 MEST


HP,

  if you only need a certain subset of functions and structs from
engine.h you could make a file like cintengine.h which only contains
a sanitized version of engine.h. For example I can't parse all X11 headers
so I do the following:

in $ROOTSYS/x11/inc/TGX11.h:

#if !defined(__CINT__)

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#include <X11/keysym.h>

#include "Xpm.h"

#else

typedef unsigned long XID;
typedef XID Drawable;
typedef XID Cursor;
typedef XID Colormap;
typedef XID Window;

struct GC;
struct Display;
struct XGCValues;
struct XSetWindowAttributes;
struct XColor;
struct XEvent;
struct XImage;
struct XPoint;
struct XpmAttributes;

Display *XOpenDisplay(char *disp_name);

#endif

So you could do:

cintengine.h:


#if !defined(__CINT__)

#include <engine.h>

#else

/* forward declarations */
typedef INT8_T char;
struct engine;
...
...

/* prototypes */
engine *newengine();

#endif


Now parsing should be no problem. The only problem is to keep cintengine.h
and engine.h in sync.



Cheers, Fons.




On Tue, Aug 01, 2000 at 10:44:02AM -0400, HP Wei wrote:
> Dear Rooters:
> 
>  I want to use a set of commercial C libraries
>  (libeng.so for Sun's Solaris) in Root/Cint (2.25).
> 
>  Following Fon's suggestion, the plan is to 
>  (1) rootcint dict.C -c engine.h   
>      to create the dictionary files for CINT.
>      Here, the engine.h is the header file from
>      this commercial package.
>      It defines a set of C functions and #include 
>      other header files.
>      
>  (2) compile this dict.C with main.C 
>      in the example in the article "CINT Dictionary Generator".
>      
>  Now, during step (1) I encounter the following three types of
>  error (warning) situations.
>  In each situation, I also append the surrounding lines
>  in the header file at issue.
>  Can anyone help out??
>  
>  
> 
> (1) ------ Limitation message
> Limitation: macro handled as typedef char INT8_T; FILE:tmwtypes.h LINE:88
> 
> ------ lines around LINE:88
> #ifndef INT8_T
> # if CHAR_MIN == -128
> #   define INT8_T char
> # elif SCHAR_MIN == -128           <------- line 88
> #   define INT8_T signed char
> # endif
> #endif
> 
> (2) ------ Error message
> Limitation: can not handle macro UINTEGER_T unsigned Use +P or -p option
>  FILE:tmwtypes.h LINE:284
> Error: class,struct,union or type UINTEGER_T not defined  FILE:tmwtypes.h 
> LINE:285
> 
> ------ lines around LINE:284
> #ifndef UINTEGER_T
> #define UINTEGER_T unsigned
> #endif                             <------- line 284
> typedef UINTEGER_T uint_T;
> 
> (3) ------ Error message
> Error: Unexpected EOF G__exec_statement() FILE:engine.h LINE:175
> Advice: You may need to use +P or -p option
> 
> ------ 
> Upon inspection of File:engine.h, I find that the line:175 is
> the end of the file:engine.h.
> 
> --------------------------
> 
> 
> 

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



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