View Single Post
Old 04-05-2008, 04:51 PM   #14
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

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;
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.

Last edited by Xenakios; 04-05-2008 at 05:04 PM.
Xenakios is offline   Reply With Quote