Hello.
I am try to write my reaper plugin.
If Reaper start with my reaper_test.dll this crash...
Please help me, and show how to write normal plugin.
my code:
Code:
#include <stdio.h>
#include <stdbool.h>
#include <windows.h>
#define REAPER_PLUGIN_DLL_EXPORT __declspec(dllexport)
#define REAPER_PLUGIN_HINSTANCE HINSTANCE
#define REAPERAPI_DEF extern
#define REAPER_PLUGIN_VERSION 0x20E
#define IMPAPI(x) if (!errcnt && !((*(void **)&(x)) = (void *)rec->GetFunc(#x))) errcnt++;
typedef struct reaper_plugin_info_t
{
int caller_version; // REAPER_PLUGIN_VERSION
HWND hwnd_main;
// this is the API that plug-ins register most things, be it keyboard shortcuts, project importers, etc.
// typically you register things on load of the DLL, for example:
// static pcmsink_register_t myreg={ ... };
// rec->Register("pcmsink",&myreg);
// then on plug-in unload (or if you wish to remove it for some reason), you should do:
// rec->Register("-pcmsink",&myreg);
// the "-" prefix is supported for most registration types.
int (*Register)(const char *name, void *infostruct); // returns 1 if registered successfully
// get a generic API function, there many of these defined.
void * (*GetFunc)(const char *name); // returns 0 if function not found
} reaper_plugin_info_t;
bool (*APIExists)(const char* function_name);
void (*APITest)();
void (*ShowConsoleMsg)(const char* msg);
int (*ShowMessageBox)(const char* msg, const char* title, int type);
REAPERAPI_DEF REAPER_PLUGIN_DLL_EXPORT int ReaperPluginEntry(REAPER_PLUGIN_HINSTANCE hInstance, reaper_plugin_info_t *rec)
{
if (rec != NULL)
{
int errcnt = 0;
IMPAPI("ShowMessageBox");
ShowMessageBox("Happy new year", "with", 0);
return 1;
}
else
{
ShowMessageBox("Quit plugin", "Good bye", 0);
return 0;
}
}