You need to "tell" the compiler/plugin that the Main_OnCommand function exists...Also to register with Reaper the ability to run commands. (By the way, this maybe deprecated/wrong info, maybe Justin will correct me if I am wrong...)
Actually, I was about to tell you how to do that, but it would probably only be valid for the project I have been working on my own. One which does not implement a new control surface. So I don't think the advice would work directly. You are probably about to meet the wonderful world of project file dependencies.
Just spent quite a lot of time today myself figuring that out...
Well, anyway if this helps at all :
You should put this before all "payload" code :
Code:
void (*Main_OnCommand)(int command, int flag);
Then put this in the "plugin entrypoint function" after the return 0 :
Code:
*((void **)&Main_OnCommand) = rec->GetFunc("Main_OnCommand");
if (!Main_OnCommand) MessageBox(NULL,"mainOnCommand not found!","Error",MB_OK);
The entry function is found in the source code by finding this :
Code:
extern "C"
{
REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(REAPER_PLUGIN_HINSTANCE hInstance, reaper_plugin_info_t *rec)
{
g_hInst=hInstance;
if (rec)
{
if (rec->caller_version != REAPER_PLUGIN_VERSION || !rec->GetFunc)
return 0;