Re: documentation on rootcint

Masaharu Goto (gotom@hpyiddq.jpn.hp.com)
Thu, 18 Dec 1997 8:59:12 JST


Bruce,

About embedding C functions,

You can use rootcint exactly the same way as you embed C++ library. The
only difference is that you'll need to add 'extern "C"' for the C function
prototypes. Let me know if this doesn't work.

#ifdef __cplusplus
extern "C" {
#endif

enum _elementHDUtype{HDU_UNKNOWN,PHDU,IMAGE,ATABLE,BTABLE,OTHER};
typedef enum _elementHDUtype elementHDUtype;
void encodeHDUtype(elementHDUtype type, char *str);

#ifdef __cplusplus
}
#endif

Makecint , raw cint version of rootcint, has C embedding mode which
enables embedding C functions without adding 'extern "C"'. Rootcint
doesn't expose this capability, however, this should be simple enough.

Masaharu Goto

>
> Hi,
> I'm trying to include just a set of C functions in root. I know, it's
> a C++ framework, but...
>
> I'm running into a problem, I believe, with the following construct:
>
>
> enum _elementHDUtype{HDU_UNKNOWN,PHDU,IMAGE,ATABLE,BTABLE,OTHER};
>
> typedef enum _elementHDUtype elementHDUtype;
>
> void encodeHDUtype(elementHDUtype type, char *str);
>
> I'm not sure how to tell rootcint about the type elementHDUtype so that
> I can run a macro of the form:
>
> char tmp[100];
> encodeHDUtype(IMAGE,tmp);
>
> and get tmp assigned the value of "IMAGE"
>
> Thanks!
> bruce
>
> --
>
> Bruce O'Neel phone: +41 22 950 91 22 (direct)
> INTEGRAL Science Data Centre +41 22 950 91 00 (switchb.)
> Chemin d'Ecogia 16 fax: +41 22 950 91 33
> CH-1290 VERSOIX e-mail: Bruce.Oneel@obs.unige.ch
> Switzerland WWW: http://obswww.unige.ch/isdc/
>