Basic string support in Cint

Hello

Is there any type of string support built into Cint which allows you to easily concatenate strings together such as with the basic_string type ??

regards
david

Hi,

Just include the string header and you can use std::string:cint.exe> { #include <string> } cint.exe> { std::string s; }

Cheers,
Philippe.

Yes it works after you rebuild the support dll’s.

regards
david

Hello

Is it possible to add functions to the dictionary which say return a std::string or can you only use the std::string type in a script ??

I seem to be having trouble adding a function to the dictionary which returns a std::string type.

regards
david

Hi,

Yes, it should be possible. Can you provide a running example showing your issue?

Cheers,
Philippe.

Hello Phillipe

This is what I added to UserMain.h

When I run setupbc.bat I get the following. The problem stems from the fact that it has not included in G__cpp_UserMain.h

Where is G__setup_cpp_environmentXXX() ?? I can’t seem to find it anywhere.

/********************************************************************
* G__cpp_UserMain.h
* CAUTION: DON'T CHANGE THIS FILE. THIS FILE IS AUTOMATICALLY GENERATED
*          FROM HEADER FILES LISTED IN G__setup_cpp_environmentXXX().
*          CHANGE THOSE HEADER FILES AND REGENERATE THIS FILE.
********************************************************************/
#ifdef __CINT__
#error G__cpp_UserMain.h/C is only for compilation. Abort cint.
#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define G__ANSIHEADER
#define G__DICTIONARY
#include "G__ci.h"
extern "C" {
extern G__DLLEXPORT int G__cpp_dllrevUserMain();
extern G__DLLEXPORT void G__set_cpp_environmentUserMain();
extern G__DLLEXPORT void G__cpp_setup_tagtableUserMain();
extern G__DLLEXPORT void G__cpp_setup_inheritanceUserMain();
extern G__DLLEXPORT void G__cpp_setup_typetableUserMain();
extern G__DLLEXPORT void G__cpp_setup_memvarUserMain();
extern G__DLLEXPORT void G__cpp_setup_globalUserMain();
extern G__DLLEXPORT void G__cpp_setup_memfuncUserMain();
extern G__DLLEXPORT void G__cpp_setup_funcUserMain();
extern G__DLLEXPORT void G__cpp_setupUserMain();
}


#include "UserMain.h"

#ifndef G__MEMFUNCBODY
#endif

extern G__linked_taginfo G__UserMainLN_string;
extern G__linked_taginfo G__UserMainLN_MSXDataInfoRec;
extern G__linked_taginfo G__UserMainLN_Array;
extern G__linked_taginfo G__UserMainLN_ArraycLcLOperatorEnum;

/* STUB derived class for protected member access */

Hi,

You just need to include string directly for UserMain.h :slight_smile:

Cheers,
Philippe.

[quote=“pcanal”]Hi,

You just need to include string directly for UserMain.h :slight_smile:

Cheers,
Philippe.[/quote]

I did but for some reason it is not picking it up :frowning:

Also my UserMain directory is not in the Cint branch. I am building it somewhere else on the disk. Could that be the problem ??

regards
david

[quote]I did but for some reason it is not picking it up [/quote]Quite strange :frowning:

[quote]Also my UserMain directory is not in the Cint branch. I am building it somewhere else on the disk. Could that be the problem ?? [/quote]No it shouldn’t … unless you created other file name UserMain.h …

Do you have a complete running example showing your problem?

Cheers,
Philippe.

Hello Phillipe

I found the problem :wink:

In my UserMain include file I needed to specify “using namespace std” otherwise the std on the std::string doesn’t get carried through when makecint builds the cpp files.

Thanks for your help. It works really well :wink:

regards
david