So, I have an object that has methods and members, and it has another object that handles it's IO.
I'm doing packet-capture, and the pcap libraries require a static call-back method.
So what I did was create a wrapper function in the main module. When I start monitoring for packets I store a the pointer for "this" in a global static variable, and the wrapper is a static method that does:
myModule me = (myModule) pointerToModule;
me.callback(args);
And during the callback it does things - stores new information in the member variables.
I've found that for some reason I then have to update the pointer after I change the data. And that my main method that kicked all this off doesn't see any updates to the information done during this callback.
So... How do I solve this problem? How do I push these updates to the object that is instantiated already?
C++ isn't my primary language, so I'm a bit out of my depth here and hoping for some help.
Thanks in advance,
Jay |