Loading dynamic libraries (dll's) from an Audio Plugin

windows

#1

Hi there!,

I’m having some fun with JUCE, and loving it!
Problem is, I’m trying to embed the V8 (javascript VM) on an audio plugin for enabling scripting on the plugin.

But as soon as I link against V8 (which is not statically compiled), the plugin fails to load, it doesn’t even get into the entry point.

So, i’m guessing somehow is not able to locate the V8 dll’s, but I tried putting them next to the vst3, on Cubase’s root folder (yep, testing with Cubase atm), and even on window’s system32 folder, but nothing, can’t get the Audio Plugin to start.

Removing any reference to V8 and rebuilding, works again.

Any help would be really appreciated!


#2

Is it an option manually load the dll and the functions during runtime in the code? (JUCE has the DynamicLibrary class to help a little with that.) It is often tricky to get dlls working by linking with the .lib dll import library.

Also, do you really need something as heavy weight as V8? What are you going to do with the scripting? JUCE itself has a simple JavaScript engine.


#3

Thanks for the reply :slight_smile:

About manually loading the dll’s and functions, I have no clue tbh, but even if that’s possible, is not gonna be pretty, at all :stuck_out_tongue:

I played before with JUCE’s JS, and it’s nice, but I really need a full featured VM in this case.

if I get any way of loading it, even if super dirty, I can spend time later trying to compile V8 statically, but need to do a proof of concept first…so whatever it takes :wink:


#4

I used to use Dependency Walker for troubleshooting issues like this. But it’s pretty obsolete now and doesn’t work so well with 64 bit software.

I just found this rewrite on GitHub. I haven’t tried it, but it’s probably worth a try: https://github.com/lucasg/Dependencies


#5

Thanks!, that’s a good idea, I’ll give it a try


#6

After playing with things, I found out there is a linker option in Visual Studio to make specific dll’s to be delay loaded under linker -> input -> delay loaded dlls
So I added v8.dll there and copied all the dll’s on Cubase’s root folder, and seems to be working, not very nice, but it will do for now :slight_smile:


#7

If you do need to use a DLL in a Windows plugin (not ideal) you can install it to a fixed location, check it exists and load it at runtime. Of course if the user deletes or moves the DLL afterwards you can’t run your plugin…


#8

@adamski, do you know of any reference of how I could do that? or do you mean using DynamicLibrary as @Xenakios suggested?

At the very end, I’ll probably end trying to compile V8 statically, but doing that will probably take me same amount of time as doing the whole thing :sweat_smile:

Thanks a lot guys!, it’s all been very helpful :wink: