Compare your method call method for a while:
GetObjectsForExportImpl( long lExportOptions, __int64 numIdProject, XExportSets &exportSets, long lClientId, CComPtr<IEPIPDServer> ptrIPDServer, FILE *fp )
to your subsequent recursive call:
hr = pExportObject->GetObjectsForExportImpl( lExportOptions, numIdProject, exportSets, lClientId, ptrIPDServer, fp);
If something magical doesn't happen between them, you simply call the method with your own set of arguments. I suspect you wanted to put "exportLocal" instead of "exportSets" there, because otherwise, what was the point of exportLocal.setShared.begin ()? You just keep re-creating the new exportLocal, telling it to start, recursive, etc.
In short, I think the problem is a coding error, not a recursion problem.
As a side note - can you think of a way to make it a loop, not a recursion? Cycles are almost always faster, easier, easier to understand, and quick to debug.
source share