vst plugins with additional dlls
-
- KVRer
- Topic Starter
- 27 posts since 9 Oct, 2014
In my vst plugin I have dependencies on some external dll libs, and when Cubase does the initialization, it reports that it cannot locate components (i.e. mentioned dlls). Is there a way to pass the path of those libs to Cubase, or some specific folder where we can put necessary additional components?
- KVRAF
- 7134 posts since 8 Feb, 2003 from London, UK
-misread before first coffee error-
Last edited by pljones on Sun Nov 09, 2014 5:48 pm, edited 1 time in total.
-
- KVRAF
- 3388 posts since 29 May, 2001 from New York, NY
Do you absolutely need the dependencies ? You should link statically if possible.
Putting the dll in the same directory as the VST will create a giant mess in the user's VST folder. These dll's will be seen as potential plugins by hosts, which will try to scan them, ...
If you can't link statically, you should put the dll in the plugin's documents folder (usually somewhere under C:/Program Data) and load it dynamically using LoadLibrary.
Putting the dll in the same directory as the VST will create a giant mess in the user's VST folder. These dll's will be seen as potential plugins by hosts, which will try to scan them, ...
If you can't link statically, you should put the dll in the plugin's documents folder (usually somewhere under C:/Program Data) and load it dynamically using LoadLibrary.
-
- KVRer
- Topic Starter
- 27 posts since 9 Oct, 2014
I tried with static libraries before, but as I remember, it all ended up the same way; host was reporting that it was unable to locate dlls. I can retry it once more .
-
- KVRer
- Topic Starter
- 27 posts since 9 Oct, 2014
summary:
-When I link static libraries, it is all the same as with dynamic linking. The host asks for dlls.
-When I add LoadLibrary to plugin constructor, the same again.
-When trying to load dlls with LoadLibrary, without linking, MinGW doesn't build the project; it gives me 'undefined reference' errors.
-When I link static libraries, it is all the same as with dynamic linking. The host asks for dlls.
-When I add LoadLibrary to plugin constructor, the same again.
-When trying to load dlls with LoadLibrary, without linking, MinGW doesn't build the project; it gives me 'undefined reference' errors.
-
- KVRian
- 573 posts since 1 Jan, 2013 from Denmark
If you do 'dynamic linking' using LoadLibrary, you cannot reference the functions in the header. You need to do something like this:user125 wrote:summary:
-When I link static libraries, it is all the same as with dynamic linking. The host asks for dlls.
-When I add LoadLibrary to plugin constructor, the same again.
-When trying to load dlls with LoadLibrary, without linking, MinGW doesn't build the project; it gives me 'undefined reference' errors.
Code: Select all
// dll:
int func(double a);
// your program - for each function, do this:
typedef int (*pFunc)(double);
pFunc func = NULL;
// dynamic binding
void bind()
{
HMODULE hMod = LoadLibrary(...);
func = (pFunc)GetProcAddress(hMod, "func");
assert(func);
// should be all good.
int ret = func(3.14);
}
- KVRAF
- 7890 posts since 12 Feb, 2006 from Helsinki, Finland
If the host is asking for a DLL then you are not really linking statically. Note that you need to use a static version of the same library (you can't use static linking with just a DLL version). Most libraries have static versions available though (or you can compile one) unless you're stuck with some LGPL licensing non-sense.
With LoadLibrary() you don't link the DLL, instead you load the DLL then explicitly ask for pointers to each function (or other symbol) that you want to use. I wouldn't really recommend this though, unless you are comfortable with function pointers and other "low-level" stuff.
With LoadLibrary() you don't link the DLL, instead you load the DLL then explicitly ask for pointers to each function (or other symbol) that you want to use. I wouldn't really recommend this though, unless you are comfortable with function pointers and other "low-level" stuff.
-
- KVRian
- 573 posts since 1 Jan, 2013 from Denmark
Well.. What is the error? Did you try to debug it?user125 wrote:Ok, I solved this by linking statically, but now the host won't load my plugin.
-
- KVRer
- Topic Starter
- 27 posts since 9 Oct, 2014
Nothing, no error message; but I found some access violation reports in log , from past few days. Access violation on winapi libs, e.g. ole32.dll, which is also linked in my project; although I doubt that this is relevant, but it's the only thing I found.