How do I link a dll that has a wrapper to godot?

Godot Version

4.4.1.stable.mono.official.49a5bc7b6

Question

I downloaded the ManagedBass wrapper for un4seen development’s libbass from nuget. However, since the library is copyrighted, the dll is not distributed along with the wrapper, and I have to include it myself, and add it to the linker. How do I do that?

The library has one dll and one interface library.

Edit, it can work if I just copy the .dll into the project’s root directory, but it’s probably not going to be bundled with the build. I meant ‘adding it’ as though adding a target_include_directory and a target_link_library in CMake.

Why don’t you try exporting it and see what happens? You can also explicitly include it as part of the export and see what happens.

It doesn’t seem to matter whether I include it explicitly, because DLLs usually aren’t resources or assets. So, ye, doesn’t work. It does work if I manually copy it into the distributable file, but I don’t think it’s a good idea to distribute an unencrypted DLL for the library, since it’s copyrighted.

Dynamic Linked Libraries have been a pain in the ass for 30 years. Sounds like nothing’s changed. Unfortunately if you can’t embed it in the pck or the exe, I don’t know what to tell you. I’ve never had to deal with DLLs in Godot. Hopefully someone else will have an idea.

After getting ahold of a more experienced dev, he clarified a few things:

  1. The DLL is meant to be distributed as a separate project.
  2. The Windows API does not seem to load DLLs from disk, so you have to map it to memory yourself, i.e., change the DLL import table and some other stuff.
  3. You can use MemoryModule, but that appears to mainly be used for viruses?

It’s this annoying since Window’s syscall table is unstable, whatever that means.

In other words, don’t do this, it’s bad practise, and difficult to do for no benefit.

1 Like