vst3 with another dlls problem

SDK for VST 3 audio plug-in and host development.
Post Reply
Wanderer
Posts: 7
Joined: Sun Jun 24, 2018 2:24 pm

vst3 with another dlls problem

Post by Wanderer » Sun Jan 12, 2020 1:49 pm

I created dll for vst3 as user interface (GUI) which depend on another dll (for example myPlugin.vst3 --> interop.dll --> gui.dll). When I run console application with my GUI everything is ok. But when vst3 is building it throw this errors:

Code: Select all

Creating library D:/Programi/Development/Audio/VST Build/lib/Debug/my_test_plugin.lib and object D:/Programi/Development/Audio/VST Build/lib/Debug/my_test_plugin.exp
  my_test_plugin.vcxproj -> D:\Programi\Development\Audio\VST Build\VST3\Debug\my_test_plugin.vst3
  * Loading module...
  
  	D:/Programi/Development/Audio/VST Build/VST3/Debug/my_test_plugin.vst3
  
  Invalid Module!
  LoadLibray failed.
D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: The command "setlocal
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: cd "D:\Programi\Development\Audio\VST Build\bin"
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: D:
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: "D:\Programi\Development\Audio\VST Build\bin\Debug\validator.exe" "D:/Programi/Development/Audio/VST Build/VST3/Debug/my_test_plugin.vst3"
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmEnd
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmErrorLevel
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: exit /b %1
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmDone
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
D:\...\Microsoft.CppCommon.targets(138,5): error MSB3073: :VCEnd" exited with code -1.
dll is set up (in vst3 project) same as for console application which is working. If dll is build to "D:\Programi\Development\Audio\VST Build\bin" then compilation throw this error:

Code: Select all

1>------ Build started: Project: my_test_plugin, Configuration: Debug x64 ------
1>my_test_plugin.vcxproj -> D:\Programi\Development\Audio\VST Build\VST3\Debug\my_test_plugin.vst3
1>
1>Unhandled Exception: System.TypeInitializationException: The type initializer for 'WPF.WApp' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'my_test_plugin_gui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Systém nemôže nájsť zadaný súbor.
1>   at WPF.WApp..cctor()
1>   --- End of inner exception stack trace ---
1>   at WPF.WApp..ctor()
1>   at WPF.wpf_app_interop.mf_AppCreate(wpf_app_interop* )
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: The command "setlocal
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: cd "D:\Programi\Development\Audio\VST Build\bin"
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: D:
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: "D:\Programi\Development\Audio\VST Build\bin\Debug\validator.exe" "D:/Programi/Development/Audio/VST Build/VST3/Debug/my_test_plugin.vst3"
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmEnd
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmErrorLevel
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: exit /b %1
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :cmDone
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
1>D:\Programi\Visual Studio 2017\Community Edition\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(138,5): error MSB3073: :VCEnd" exited with code -532462766.
1>Done building project "my_test_plugin.vcxproj" -- FAILED.
vst3 project doesn't create bundle I turned it off. Where can be problem?
Btw. vst3 project without my dlls is compiled ok and even I can run it in Reaper host

Wanderer
Posts: 7
Joined: Sun Jun 24, 2018 2:24 pm

Re: vst3 with another dlls problem

Post by Wanderer » Mon Jan 13, 2020 12:34 pm

I found that my dlls must be each on different locations, for example interop.dll must be in bin folder, and gui.dll must be in Debug / Release folder where is validator.exe, after that validator run without problem. Problem arise when I want use my vst3 with those dlls outside Release folder. When they are next to vst3 file, it doesn help. And I have no clue where to add it. When I look at https://steinbergmedia.github.io/vst3_d ... t3loc.html I tried create Resources folder and put dlls here, but it doesn't help. Btw. plugin load with GUI when I use SAVIhost.exe where I build my vst3.

Arne Scheffler
Posts: 312
Joined: Mon Jun 20, 2016 7:53 am

Re: vst3 with another dlls problem

Post by Arne Scheffler » Mon Jan 13, 2020 4:51 pm

This is nothing special to vst3, you have to check how your system searches for dynamic libraries.
Have a read : https://docs.microsoft.com/en-us/window ... arch-order

Cheers,
Arne

Wanderer
Posts: 7
Joined: Sun Jun 24, 2018 2:24 pm

Re: vst3 with another dlls problem

Post by Wanderer » Mon Jan 13, 2020 6:23 pm

I don't do any special to load dll. It is simple .lib and dll is c++/cli which export class. I expected that when dlls are next to *.vst3 it will be fine, but it looks like host which load vst3 change the rule. If I understand from post you give me, I should use manifest or DLL redirection?

Arne Scheffler
Posts: 312
Joined: Mon Jun 20, 2016 7:53 am

Re: vst3 with another dlls problem

Post by Arne Scheffler » Tue Jan 14, 2020 4:14 pm

You have to read up on how a dll is loaded on Windows. As far as I know, if you are linking a dll with another dll you have to make sure that the dll you link to is in the search path of the application. As you want your dll to be loaded from any application where your dll is loaded into, you have to load the dll at runtime with LoadLibrary and use GetProcAddress etc.

Cheers,
Arne

Wanderer
Posts: 7
Joined: Sun Jun 24, 2018 2:24 pm

Re: vst3 with another dlls problem

Post by Wanderer » Thu Jan 16, 2020 8:31 pm

I partially reslove it, I just simply SetDllDirecotry and my interop.DLL is loaded. Unfortunately I can't resolve load managed gui.DLL.

For managed DLL I created AppDomain and attach AssemblyResolve Handler which load DLL Assermbly::LoadFrom(pathToDLL); which is working on first time. Plugin is loaded, but when I load another instance of my plugin, host crash. If someone have knowledge about how to load managed DLL, please, write how to correct load manage DLL. Thanks.

Post Reply