I am working on a program that has C and C++ elements to it. I can't say I am an expert in this realm but I am noticing that a static variable isn't acting so static. Specifically I receive events asynchronously and then push events onto a static queue while the main thread pops off events from that static queue. When I push events onto the static queue I can clearly tell the queue increases by one and data is populated correctly. When I poll from that static queue the data is gonna and the queue size is 0. To confirm they act as different instances I printed their values from the asynch and the polling perspective and they both stay consistently different even though the variable has a stinking static attached to it. The static queue is stored in a .c file while I update the queue from a .cpp file. I'm almost positive this wouldn't cause issues but who knows. I'm stuck
Here are my two variables stored in the interactivity_mapping file...
/* Pointer storage */
static sdy_pointer_event_t pointer_events[MAX_POINTERS] = {0};
static int last_pointer_event = 0;
Here are the extern functions stored in the imported functions c file
/* Imported functions */
extern void GetId(SGLint32 (*WidgetId));
extern void ManageIndividualFocus(SGLbool RequestFocus, SGLbool RequestNoFocus, SGLint32 WidgetId, SGLbool IsContainer, SGLint32 NextWidgetId, SGLbool isInit, SGLint32 (*HasFocus));
extern void aol_keyboard(SGLint32 pKeyboard, SGLbool* pPressed, SGLbool* pReleased, SGLint32* pCode, SGLint32* pModifiers);
extern void aol_locate(SGLint32 pPointer, SGLfloat* pX, SGLfloat* pY);
extern void aol_pointer(SGLint32 pPointer, SGLbool* pPressed, SGLbool* pReleased, SGLint32* pButton, SGLfloat* pX, SGLfloat* pY, SGLint32* pModifiers);
extern void wrapper_PushButton(SGLint32 EmitCondition, SGLbool MouseInside, SGLbool MousePressed, SGLbool MouseReleased, SGLbool KeyPressed, SGLint32 KeyCode, SGLbool KeyReleased, SGLbool (*Selection), SGLbool (*ButtonPressed), wrapper_PushButton_mem* mem);
extern void wrapper_PushButton_reset(wrapper_PushButton_mem* mem);
Essentially in interactivity_mapping file there are implementations of the extern imported functions c file. The function I call asynchronously is not a part of this imported functions extern c file while the polling function is and is called aol_pointer. I don't know if this would cause this type of incorrect behavior though. The program is quite large so I don't think I can give a better picture without dumping the whole thing on here.