Get Game Mode or World Context from Extern "C" Function?

I have this function that is called by a Javascript function and it gives me a String that i need to know its content to use in my game mode, is there a way to extract to the gamemode?
Do i have to use global variables? If yes, is there a source that i can follow allong?

 extern "C" void EMSCRIPTEN_KEEPALIVE receiveString(char *str) 
    	FString returnedDataString(str);
    	GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, returnedDataString);

Used a static variable, what i didn’t know is that you have to initialize the static variable before any other code: