Date/Time: Sat, 19 Jan 2019 01:11:31 +0000
Post From: SetString outside of default block
|Sporken - Posts: 81|
Different user here:
I just tested this as well and got the same result. Building with VS2017 v15.3.4
I tested with optimizations on and off using #pragma with this code
#pragma optimize( "", off )
SCSFExport scsf_test_string(SCStudyInterfaceRef sc)
SCInputRef str1 = sc.Input;
SCInputRef str2 = sc.Input;
sc.GraphName = "Test String";
sc.StudyDescription = "";
sc.AutoLoop = 1;
sc.GraphRegion = 0;
sc.FreeDLL = 0;
str1.Name = "Str1";
str2.Name = "str2";
if (sc.Index == 0)
if (sc.Index == sc.ArraySize-1)
SCString tmp1 = str1.GetString();
SCString tmp2 = str2.GetString();
SCString tmp3 = tmp1 + " " + tmp2;
sc.AddMessageToLog(tmp1 + " " + tmp2, 0);
#pragma optimize( "", on )
Sierra charts version is 1656.
I have also recently seen a strange, unexplained, possibly related/unrelated text problem on my "Add Study" window. Occasionally my custom Study names (that come from SCSFExport scsf_studyname) are corrupted with log messages from the study itself. Messages that are output AFTER the SetDefaults block.
So an entry in the Add Study window would read, literally
"scsf_Jason_LiveStudyLoadDataFromFile : %s %s ---- Checking Hash before reading "
So the text is showing the %s %s from the code text rather than being the output of the execution of that string through the Format command.
I've been trying to track down the problem for at least the last month but it keeps "fixing itself" and then reappearing.
This might be unrelated or perhaps there's a problem with stack/heap corruption or perhaps the lifespan of SCString objects is causing the same memory to be reused.
I tested this again with an entirely fresh empty chart and it filled my log window very rapidly with this -
Chart: ESZ17 [M] 1 Min #1 | Study: Test String | str1_updated str2_updated | 2017-12-04 12:59:41
Date Time Of Last Edit: 2017-12-04 12:20:50