Support Board
Date/Time: Mon, 10 Mar 2025 02:45:55 +0000
Post From: thread safe
[2022-03-08 16:33:29] |
Tony - Posts: 553 |
I would assume it's safe, I am using a few global functions. My situation is I have 2 studies, let's say, Provette1 and Provette2, both need to call test(), that was when things could get messed up, what I did was having some public arrays, example: int result[2] = {0,0}; and Provette1 always writes result in result[0] and Provette2 in result[1], it works very well, maybe there are better solutions. (all public variables can be accessed by all studies, even between different charts in the same chart book, which is very handy) // The top of every source code file must include this line #include "sierrachart.h" SCDLLName("Provette") int result[2] = {0, 0}; double other_result[2] = {0.0, 0.0}; void test(int i, int result_target){ //do the job result[result_target] = whatever_integer; other_result[result_target] = whatever_double; } SCSFExport scsf_Provette1(SCStudyInterfaceRef sc) { //codes test(whatever_input, 0); } SCSFExport scsf_Provette2(SCStudyInterfaceRef sc) { //codes test(whatever_input, 1); } Date Time Of Last Edit: 2022-03-08 16:43:07
|