This is documented in "ReleaseNotes.html" document for version 6.20
Batch: New Command DataPluginCmd
Function: Calls the DataPluginCmd function from the data plugin (if exported from your data DLL).
Purpose: Allows custom actions to be performed by the plugin from the batch (e.g., maintenance tasks like for example Norgate plugin is doing).
Automation & Batch Support
This function enables automation/batch support for any user-provided features. For example, a batch script could use:
DataPluginCmdmycommmand
where mycommmand is the string passed to the plugin DataPluginCmd function
to run internal database maintenance by the plugin. This functionality is particularly useful for data vendors, such as Premium Data, to automate maintenance tasks.
Preliminary Information (Subject to Change)
To support this feature in your plugin, you need to export the DataPluginCmd function.
DPC_INVALID_COMMAND = -1:
The command passed is invalid or does not exist.
DPC_NOT_IMPLEMENTED = 0:
Plugin does not implement any commands. This is automatically set by AMiBroker prior to calling Notify().
DPC_SUCCESS = 1:
The command completed successfully (executed and finished).
DPC_STARTED_IN_THREAD = 2:
(For future use - not implemented yet)
The command is recognized but launched by the plugin in a separate thread. Completion will be signaled by sending a proper finalize message.
Note: When starting in a separate thread, you should NOT use the pCmdData pointer after the function returns, as it is temporary and will be destroyed as soon as DataPluginCmd returns.
Note 2: This PLUGINAPI define ensures that function name generated by the compiler uses extern "C" linking (NO C++ name decoration).
This has a very useful case.
So plug-in builds a mini-DB as RT quotes arrive. As discussed earlier, if Ticker is in 0 context, GetQuotesEx() is never called.
The batch (say periodically or EoD) whenever it runs, calls a dummy Filter=1 on "ALL Symbols".
Post completion of Explore ( or Scan etc), the next batch line can CONFIRM by way of data-command to plugin-DB that quotes are pushed to AB-DB and memory can be freed up with "Certainty".
@Tomasz while it is obvious, sometimes missing a small thing can be head scratching
Kindly update the Function Definition for others reference too in your above post.
With the C style export ( extern "C"), PLUGINAPI is mandatory,
and Thanks for helping out.
PLUGINAPI int DataPluginCmd( LPCTSTR pszCommand, struct CommandData *pCmdData );
Yes all plugin exposed functions need to be extern "C" so their names don't get C++ decoration. Using PLUGINAPI provides that plus declares function as export for the linker