Login Page - Create Account

Support Board


Date/Time: Sun, 16 Mar 2025 08:00:31 +0000



Post From: DLL makes program unstable / CPU Exception

[2021-12-10 01:40:37]
KylieV1618 - Posts: 67
Im compiling a study in Visual Studio 2019. (yay finally figured out how).

But now Im running into an issue when I attach the study to my chart it says,.,...

Warning: This Custom DLL study may cause Sierra Chart to be unstable until you remove the study from the chart and restart Sierra Chart. | 2021-12-09 17:34:27.753 *
Warning: The Custom DLL study "SierraChartAudio.scsf_AudioTest" has just caused a CPU exception. | 2021-12-09 17:34:29.890 *


And it just keeps going.

The code is simply importing a sound library called cute_sound.



// The top of every source code file must include this line
#include "sierrachart.h"
#define CUTE_SOUND_IMPLEMENTATION
#include <cute_sound.h>

SCDLLName("DOES_THIS_FUCKING_WORK_2")

// Some global variables that I want to use in other studies, all linked to same sound context.
cs_loaded_sound_t wave1;
cs_playing_sound_t wave1Instance;
cs_context_t* ctx;
HWND hwnd;


void initSound() {
hwnd = GetConsoleWindow();
ctx = cs_make_context(hwnd, 44100, 8192, 0, NULL);
wave1 = cs_load_wav("C:\pathtosound etc");
wave1Instance = cs_make_playing_sound(&wave1);

// Play the sound to test its working
cs_insert_sound(ctx, &wave1Instance);

}


... rest of my study code



Then I have it in one study, initializing it.


SCSFExport scsf_AudioTest(SCStudyInterfaceRef sc)
{  
  if (sc.SetDefaults)
  {
    sc.GraphName = "AusioTest";

    sc.AutoLoop = 0;
    sc.GraphRegion = 0;

initSound();

    return;
  }

}

And this just causes the DLL error that says CPU Exception. That then seems to run in a loop. Which is wierd because I thought setDefaults was only supposed to be called once??
Date Time Of Last Edit: 2021-12-10 01:42:19