#include <map>

typedef void(*function)(void*);
std::map<std::string, function> funcmap;

void doCreate(void *_args){
    //intended to be passed a string, testing using Void* and string casting.
	std::string strVal = *(std::string *)_args; //if breakpointed, strVal == Str1.
	
	if (strVal == "Str1") //as strVal == Str1 this is true.
		fprintf(stdout, "Str1 is set but it = %s\n", strVal.c_str()); //output is: "Str1 is set but it = <unicode characters>"

	fprintf(stdout, "value  = %s\n", strVal.c_str()); //output is the same as above: "value = <unicode characters>"
}

void functionRun(std::string s){
	std::string strings;
	strings = "Str1"; 
	(*funcmap.at(s))(&strings);
}

int main(){
    funcmap["onCreate"] = doCreate;
    functionRun("onCreate");
}