helgoboss / reaper-rs

Rust bindings for the REAPER C++ API
MIT License
78 stars 8 forks source link

Compiling starter extension + placing .dll in REAPER/UserPlugins but don't see extension or console message #34

Closed GavinRay97 closed 3 years ago

GavinRay97 commented 3 years ago

So I believe I have everything configured + compiled right, tried to fit all the pertinent stuff in this screenshot:

image

After compiling, I copied the .dll into /REAPER/UserPlugins, and launched REAPER, but didn't see any console message, or find it in the Actions list/Extension menu:

image

I tried copying all of the files in the target build folder that had the same name as the .dll (maybe the .dll needs these as dependencies?) into UserPlugins too, but still no luck:

GrN1IxTEMT

Sorry if this is stupid -- I'm not sure I can figure out what I've done wrong

GavinRay97 commented 3 years ago

Okay, so because I had no way of telling whether the code was ever even being run, I added code to write a dummy text file to /UserPlugins just to be sure something was happening:

fn write_test_file() {
    fs::write(
        "C:\\Users\\rayga\\AppData\\Roaming\\REAPER\\UserPlugins\\testfile.txt",
        "Rust extension .dll code was executed",
    )
    .expect("Unable to write file");
}

#[reaper_extension_plugin]
fn plugin_main(context: PluginContext) -> Result<(), Box<dyn Error>> {
    let session = ReaperSession::load(context);
    session
        .reaper()
        .show_console_msg("Hello world from reaper-rs medium-level API!");
    write_test_file();
    Ok(())
}

Starting up again, the file was not written. So clearly, this plugin is never even getting initialized 🙁


After investing more, I noticed that almost all of the native plugins, have names beginning with prefix reaper_.

On the wild chance that this might fix it, I tried renaming extension to reaper_my_extension.dll, and running again:

image

And then...

image

🤯

Okay, so the extension name has to begin with reaper_ in order for it to be loaded I suppose?

I will submit a PR with a note in the README about this if that is okay?

helgoboss commented 3 years ago

Hi! Yes, it needs to start with "reaper_". A README entry is a good idea!

GavinRay97 commented 3 years ago

Hi! Yes, it needs to start with "reaper_". A README entry is a good idea!

Awesome, sent! =D