Login Page - Create Account

Support Board


Date/Time: Sat, 11 Jan 2025 20:46:27 +0000



scsf_DynamicMemoryAllocationExample does not compile

View Count: 835

[2016-12-26 14:48:35]
b3cker - Posts: 34
Web help example scsf_DynamicMemoryAllocationExample does not compile (MV C++) in otherwise compliable project.

Thank You
[2016-12-26 17:32:30]
Sierra Chart Engineering - Posts: 104368
We tested compiling this function using the "Remote Build" command and it did compile without issue. Not sure what problem you are having with Visual C++.

This is what we tried compiling:
SCSFExport scsf_DynamicMemoryAllocationExample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    // Set the configuration and defaults

    sc.GraphName = "Dynamic Memory Allocation Example";

    sc.AutoLoop = 0;

    sc.FreeDLL = 0;

    return;
  }


  // Do data processing
  double * p_DoubleArray = (double*)sc.GetPersistentPointer(1);

  if(sc.LastCallToFunction)
  {
    if(p_DoubleArray != NULL)
    {
      sc.FreeMemory( p_DoubleArray);
      sc.SetPersistentPointer(1, NULL);
    }

    return;
  }

  if(p_DoubleArray == NULL)
  {
    //Allocate an array of 1024 doubles.
    p_DoubleArray = (double *) sc.AllocateMemory( 1024 * sizeof(double) );

    if(p_DoubleArray != NULL)
      sc.SetPersistentPointer(1, p_DoubleArray);
    else
      return;
  }

  //assign value to one of the elements
  p_DoubleArray[0] = 100;

  return;

}

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

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account