Question about plugin types


#1

Hi,

I have written a plugin dll that is intended to provide both data and AFL functions in AmiBroker 6.25 x64. In Plugin.h from the ADK, we have the following definitions:

// Possible types of plugins
// currently 4 types are defined
// PLUGIN_TYPE_AFL - for AFL function plugins
// PLUGIN_TYPE_DATA - for data feed plugins (requires 3.81 or higher)
// PLUGIN_TYPE_AFL_AND_DATA - for combined AFL/Data plugins
// PLUGIN_TYPE_OPTIMIZER - for optimization engine plugins (requires v5.12 or higher)

#define PLUGIN_TYPE_AFL 1
#define PLUGIN_TYPE_DATA 2
#define PLUGIN_TYPE_AFL_AND_DATA 3
#define PLUGIN_TYPE_OPTIMIZER 4

In Plugin.cpp, I am using:

#define THIS_PLUGIN_TYPE PLUGIN_TYPE_AFL

////////////////////////////////////////
// Data section
////////////////////////////////////////
static struct PluginInfo oPluginInfo =
{
	sizeof(struct PluginInfo),
	THIS_PLUGIN_TYPE,
	PLUGIN_VERSION,
	PLUGIN_ID,
	PLUGIN_NAME,
	VENDOR_NAME,
	0,
	387000
};

If I define THIS_PLUGIN_TYPE as PLUGIN_TYPE_AFL, my AFL functions are exported and work properly, but (as expected) AmiBroker does not recognize the plugin a data source.

If I use PLUGIN_TYPE_DATA, AmiBroker does recognize the plugin as a data source, but (as expected) my AFL functions do not work.

If I use PLUGIN_TYPE_AFL_AND_DATA, neither one of them work.

Is PLUGIN_TYPE_AFL_AND_DATA supported? What might I be doing wrong?

Thanks everyone!
-Alan


#2

No PLUGIN_TYPE_AFL_AND_DATA is not supported.
You have to have separate AFL plugin and separate DATA plugin.
Back in 2003 there was a plan to allow mixed type plugins but this has been abandoned in the light
of multithreading. AFL plugins and Data plugins live in different threads. AFL plugins live in worker threads while data plugin lives in the UI thread. These two do not mix and this makes mixed plugins impossible.


#3

Thanks Tomasz,

I will separate them. I just wanted to make sure I wasn’t missing something.

-Alan