I'm trying to write a simple RTD client to start with something, but I seem not able to make the initial connection. I have found some examples on the web, and best seemed to be this RTD client in C# gist.
Having this on MS-Excel: =RTD("rtdtrading.rtdserver",, "WINZ20_F_0", "HOR")
- formula works on Excel and pulls fresh data.
In the code from the gist above, I then tried to instantiate the object with:
var handler = new RtdClient("rtdtrading.rtdserver");
So far, so good. But then, when I try to
var valList = handler.GetValue(new object[] { "WINZ20_G_0", "HOR" });
I get a big Catastrophic failure (0x8000FFFF (E_UNEXPECTED)) from IRtdServer.ConnectData(Int32 topicId, Object[]& parameters, Boolean& newValue)
, line 24 in the code above.
If I try to use new string[] { "WINZ20_G_0", "HOR" });
, then the error changes to Specified array was not of the expected type, happening a bit deeper, but I believe still before ConnectData()
is actually run, as the call stack suggestes:
at System.StubHelpers.MngdSafeArrayMarshaler.ConvertSpaceToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome)
at ProfitRTDAnalyzer.Program.IRtdServer.ConnectData(Int32 topicId, Object[]& parameters, Boolean& newValue)
I can't seem to properly identify how to handle this. Changing the object[]
refs to string[]
where they relate to those arguments (the topic list), didn't help either (still _array was not of expected type).
According to MS documentation, ConnectData() receives as second parameter a single-dimensional array of strings, so I don't know what is wrong here.
User contributions licensed under CC BY-SA 3.0