Используйте свой пользовательский класс в качестве параметра - например:
public class CustomData
{
public string Input;
public string Output;
}
...
CustomData data = new CustomData();
data.Input = "Something";
gameInstance.SendMessage("MyObjectName", "MyFunctionName", data);
//use data.Input inside MyFunctionName like a parameter
//change data.Output inside MyFunctionName
//use data.Output
Debug.Log(data.Output);
Can you try manually redirecting stderr?
FILE* stderr_redirect = freopen( "C:/stderr.log", "w", stderr );
// Code that writes to stderr
fclose( stderr_redirect );
Edit:
There is no way to redirect stdout or stderr for a service other than to handle those streams inside your service yourself. Some services provide an option to redirect these messages to a file. You could either temporarily redirect these streams or add an option to your service to make it configurable next time you have a problem.
If you are modifying the code to the service, you could call SetStdHandle in your ServiceMain:
SetStdHandle(STD_ERROR_HANDLE, logFileHandle);