for my Rhino/Grasshopper plugin in C#, I’m using an external foo.dll which prints important information to the System.Console. Now this info doesn’t show up anywhere obviously as I’m not calling foo.dll from the windows command line but from inside Rhino. Is there a way to forward this System.Console info to the Rhino command line console directly without invoking Rhino.RhinoApp.WriteLine whenever I call a command from foo.dll?
I tried something like:
thanks for the reply! My problem is, that I’m not calling
Console.WriteLine(“Hello!”)
within the plugin.gha. The console info is generated in the referenced foo.dll. I thought that this console info would naturally be forwarded to plugin.gha as it sets the scope for foo.dll functions.
(side note: foo actually consists of two parts: fooCore.dll (C++) and fooCLI.dll (C++/CLI). fooCLI.dll only serves to forward calls from plugin.gha to fooCore.dll and vice versa; so plugin.gha only makes calls into fooCLI.dll and in return receives console info that is generated with std::cout calls in fooCore.dll)
However, when I’m using fooCLI.dll from a testing ConsoleApplication.cs, the console info (coming from fooCore.dll) is shown in the command window. So the info does arrive in the C# context of ConsoleApp.exe. But when I plug things together inside plugin.gha using
Console.SetOut(RhinoApp.CommandLineOut);
it seems to loose track of that info stream.
Also calls to fooCLI.dll are made from a different thread inside plugin.gha. So I’d have to make it thread safe somehow. Earlier I used