To support asynchronous functions, a project needs two small changes to the code. If you select "Support asynchronous functions" in the XLL+ AppWizard when you create the add-in project, these lines will be added for you.
In the project header file, add the following line:
#include <rtdlink.h>
This pulls in all the necessary run-time class definitions.
Within the definition of the application class, declare
a member variable named m_rtd
, of type CRtdLink
:
class CAvgOptApp : public CXllApp { ... // Data CXlOperCache m_cache; CString m_strCacheFile; // Asynchronous functions CRtdLink m_rtd; ... };
The CRtdLink will create and manage the worker threads, handle the RTD server comunications and hold the data cache.
With these changes in place, your asynchronous functions will compile and run successfully.