problem in adding a command by Draw_InitAppli with OCC651


since 1996, I used to add a command as follows :

static Standard_Integer MyLine( Draw_Interpretor& d, Standard_Integer argc, char argv **a )

void Draw_InitAppli ( Draw_Interpretor& theCommands ) {
Draw::Commands ( theCommands ) ;
GeometryTest::AllCommands ( theCommands ) ;
BRepTest::AllCommands ( theCommands ) ;

// Adds my command
// ------------------------------
char *g ="Sketcher Command";
theCommands.Add( "sketcher", " sketcher name x1 y1 ", MyLine, g );

When I try to build my package executable, I can read this message :
Info : -------> Polytope.cxx
Error : Errors occured in Shell
C:/OCC/OCC651/wok/wok_entities/refw2010/src/Polytope/Polytope.cxx(394) : error C2664: 'void Draw_Interpretor::Add(const Standard_CString,const Standard_CString,const Draw_CommandFunction,const Standard_CString)' : impossible de convertir le paramètre 3 de 'Standard_Integer (__cdecl *)(Draw_Interpretor &,Standard_Integer,char **)' en 'const Draw_CommandFunction'

Cette conversion requiert reinterpret_cast, un cast de style C ou un cast de style fonction

I am trying to work with OCC651, in 32 bits on windows7 with Visual Studio 2010.

I have no problem with OCC620.

Who has an idea ?



Forum supervisor's picture

Dear Denis,
Starting from OCCT630 the definition of CString is changed to
"typedef const char* Standard_CString;"
See Standard_TypeDef.hxx file.
As result you got the specified error message.