Why cant I call getPlugin?

Getting back into plugin programing, and I feel like I must be missing something obvious, but maybe someone else can help me see what it is…


void SeqBaseWidget::appendExpanderContextMenu(Menu* menu){
	Plugin* p = plugin::getPlugin("JPLab");


src/JPSeqBase.cpp: In member function 'virtual void JP::SeqBaseWidget::appendExpanderContextMenu(rack::ui::Menu*)':
src/JPSeqBase.cpp:4403:29: error: 'getPlugin' is not a member of 'rack::plugin'; did you mean 'Plugin'?
 4403 |         Plugin* p = plugin::getPlugin("JPLab");
      |                             ^~~~~~~~~
      |                             Plugin

Is plugin.hpp somehow not getting included? Does it work if you put #include <plugin.hpp> directly in your code?

#include <plugin.hpp> didn’t fix it, but how do I tell it I mean the plugin.hpp in the rack SDK and not the plugin.hpp in my code?

good question.

You could add #pragma message “in in my plugin.hpp”, assuming pragma message works in gcc - I think it does.

I guess if you did the include on a full path you can control it? like "#include “…/…/some-path/the-file-I-want.hpp”? I’ve never run into this in rack - I guess it’s unusual for a plugin to call some rack functions at global scope… don’t know.

So I renamed my plugin.hpp to plugin2.hpp and explicitly included <plugin.hpp> and that fixed it. So it does seem like it needs to be included.

Using the full path also works, but how do I make that work on different computers / when VCV builds it?

I don’t know. @cschol would know. Or you can try it with the toolchain build. I’m guess there is some macro that expands to the sdk path? Or if not you could always pass RACK_DIR into your cpp file? Kind of like the way it’s already used in the make file"

FLAGS += -I$(RACK_DIR)/include -I$(RACK_DIR)/dep/include
1 Like

You only include rack.hpp in your plugin, not plugin.hpp.

plugin.hpp is also not exposed in rack.hpp and therefore not part of the public API. See the note at the top of rack.hpp and proceed knowing that this is unsupported/unstable.

1 Like

Yeah that makes sense. Thanks. This won’t be the first time I’ve skirted the API.

It does seem weird to me that VCV Rack API: VCV Rack API includes functions that aren’t part of the API. But in general I don’t actually find that website that helpful.