Login Page - Create Account

Support Board


Date/Time: Thu, 21 Aug 2025 15:47:09 +0000



Post From: Linux

[2025-08-11 11:34:01]
User921987 - Posts: 242
My DLL problem described in the Linux | Post: 411591 is now solved as follows,

1. Template Symbol Generation: When I use static Test<float> test; inside a function, the compiler generates symbols for the template instantiation that can interfere with Sierra Chart's dynamic loading.
2. Static Local Variables: Static variables inside exported functions can create additional symbols that the DLL loader tries to resolve.
3. Template Mangling: The compiler creates mangled names for template instantiations that may not be properly handled by Sierra Chart's loading mechanism.

To fix the problem I stopped using 'static' variables and instead utilized the Get/SetPersistentPointers() methods as shown below:

#include "sierrachart.h"

SCDLLName("Test")

template <typename T>
class Test {
public:
std::deque<T> data;
};

SCSFExport scsf_Volatility(SCStudyInterfaceRef sc) {
auto test = static_cast<Test<float>*>(sc.GetPersistentPointer(0));

if (sc.LastCallToFunction) {
if (test) {
delete test;
test = nullptr;
}
return;
}

if (test == nullptr) {
test = new Test<float>();
sc.SetPersistentPointer(0, test);
}
}

Btw. This is intentionally made this simple for testing purposes, and therefore lacks all the normal configurations required by the indicator. In my experience they (by their absence) have no effect.
Date Time Of Last Edit: 2025-08-12 07:45:42