I was supplied with a static library (lib which I do not have the source code for)
The library contains two methods:
A Set method & a Get method – the library is not multi-instance (I assume the variable being set or get is a global variable).
I then created a free-threaded com object (an ATL 7 attributed DLL containing a free threaded aggregated object).
I added 2 methods to the com object Set/Get each of these methods triggers the execution of the Set & Get methods of the static library (respectively).
I then wrote a tester which creates 2 instances of the com object.
It then performs Obj1->Set(1)
And runs an endless loop of
Both results of the Get methods are send to the output window using the ATLTRACE2 macro.
The amazing thing is – and finally here is my question – I get an endless output of 1 , 2 ,1 , 2 …
While what I expected would happen is an endless output of the number 1 OR the number 2 right after both of the Set methods where called.
(when I tried to code a similar library and use it the same way I did get the expected 1,2,1,1,1,1,1…)
Any ideas what is so special about this static library?