Login Page - Create Account

Support Board


Date/Time: Thu, 06 Mar 2025 03:24:26 +0000



Post From: ACSIL - How to use sc object in header file?

[2022-01-14 12:18:32]
User310645 - Posts: 49
Each time Sierra calls into your study you get a new SCStudyInterfaceRef so no you cannot store it between calls.

If your objects are created and destroyed on each call then yes you could pass the sc ref in a constructor to any class you define in a header file.

Header file


class SomeFuncClass {

public:
SomeFuncClass(SCStudyInterfaceRef r) : sc(r);

DoSomethingWithScRef() {
sc.Something();
}

private:
SCStudyInterfaceRef sc;
}

Normal study .cpp file


SCSFExport scsf_StudyEntryPoint(SCInterfaceStudyRef sc) {

/* usual study setup/init */

SomeFuncClass myObj(sc);

myObj.DoSomethingWithScRef();

}

If you have objects you want to persist across study entry calls then you would have to use sc.Get/SetPersistentPointer(). However, you would still need to update any stored study ref on each call into the your study.