Support Board
Date/Time: Tue, 26 Nov 2024 13:18:55 +0000
Post From: Dynamic Memory Allocation
[2014-03-08 07:58:05] |
Sierra Chart Engineering - Posts: 104368 |
We did respond earlier but the response we gave we realized was not relevant to the issue. We have tested this code and it worked properly: SCSFExport scsf_DynamicMemoryAllocationExample(SCStudyInterfaceRef sc)
{ if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "Dynamic Memory Allocation Example"; sc.AutoLoop = 1; // During development set this flag to 1, so the DLL can be modified. When development is done, set it to 0 to improve performance. sc.FreeDLL = 0; return; } // Do data processing double * p_DoubleArray = (double*)sc.PersistVars->i1; if(sc.LastCallToFunction) { if(p_DoubleArray != NULL) { delete p_DoubleArray; sc.PersistVars->i1 = NULL; } return; } if(p_DoubleArray == NULL) { //Allocate an array of 1024 doubles. p_DoubleArray = (double *) new double[1024]; if(p_DoubleArray != NULL) sc.PersistVars->i1 = (int)p_DoubleArray; else return; } //assign value to one of the elements p_DoubleArray[0] = 100; return; } Therefore, there must be some other problem going on. We cannot completely see your code. What happens when you test the function above as it is. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2014-03-08 07:58:28
|