class ExampleObj {
_bstr_t test_string_;
void doSomething(TS::SequenceContext* seqContext);
void doSomething2();
};
// Create the ExampleObj
ExampleObj test;
// Called by TestStand to set Local Variable
void* storeExampleObj() {
test.test_string_ = "hello world";
return &test;
}
// Called by TestStand to use the Local Variable
void useExampleObj(TS::IEngine* engine, TS::PropertyObject* locals) {
void* example_obj = locals->GetValIDispatch("example_obj", 0);
// convert the void* into an ExampleObj*
ExampleObj ex = static_cast<ExampleObj*>(example_obj);
// Try accessing the test_string_ field
engine->DisplayMessageBox(ex->test_string_, "test", TS::MsgBox_Information, 0, 0);
}
I am using the C/C++ DLL Adapter. I can create an ExampleObj in my code and reliably store the pointer as an Object Reference in Local Variables. I can also reliably access the Object Reference from my code and use the functions. However, if I try interacting with test_string_, I receive "System Level Exceptions" in TestStand.
Does anyone know how to access/manage fields of objects stored in Local Variables?