I have my char *variables working now, here's the current py++ code I am using, any comments would be appreciated

for (className, varName) in stringVars:
    wrapClass = mb.class_(className)
    wrapAlias = wrapClass.wrapper_alias

    wrapperCode = """
        char *wrap_%s;
        void set_%s(%s& inst, bp::object obj){
            char **strPtr = &wrap_%s;
            if(*strPtr != NULL) delete *strPtr;
            bp::extract<std::string> x(obj);
            if (x.check()){
                std::string str = x();
                *strPtr = new char[str.length()+1];
                strcpy_s(*strPtr, str.length()+1, str.c_str());
                *strPtr = NULL;
            inst.%s = *strPtr;
        static boost::python::object get_%s(%s& inst){
            std::string str;
            if(inst.%s != NULL){
                std::string str(inst.%s);
                return bp::object(str);
                return bp::object();
        """ % (varName, varName, className, varName, varName, varName, className, varName, varName)
    constructorCode = "wrap_%s = NULL;" % (varName)
    add_constructors_body(wrapClass, constructorCode)
    registrationCode = 'add_property("%s", &%s::get_%s, &%s::set_%s)' % (varName, wrapAlias, varName, wrapAlias, varName)