DllNotFoundException, multiple C# and C++ DLLs

We have a project which is using several dlls, these are:

  • GuitarNotes.dll (C#)
  • Bass.Net.dll (C#)
  • bass.dll (C++)
  • bassasio.dll (C++)
  • fftwlib.dll (C#)
  • libfftw3-3.dll (C++)

We have these dlls place in the three following places:

  • Project/Assets/Plugins folder
  • Project
  • (Program Files)/Unity/Editor

As suggested by just about every thread about DllNotFoundException we’ve found.

For a bit of reference-clarity, GuitarNotes.dll references Bass.Net.dll and fftwlib.dll. Bass.Net.dll references bass.dll and bassasio.dll and fftwlib.dll references libfftw3-3.dll.

We have a script that only interacts with GuitarNotes.dll. The first thing GuitarNotes.dll does upon use is to utilize Bass.Net.dll (and its wrapped C++ DLLs) for some setup and audio recording after which it proceeds to use fftwlib.dll to call functions in libfftw3-3.dll to perform FFTs (surprise!). We do not directly use anything but GuitarNotes.dll.

Initially Unity could not find bassasio.dll, but after placing it in both Project/Assets/Plugins and Project (root) it was found. Unity now proceeds to not find libfftw3-3.dll no matter how many of the above three places it is placed. How can this be?

We’ve tried importing the libfftw3-3.dll functions using [DllImport (“libfftw3-3”)] to no avail, which honestly didn’t surprise us much since both Bass C++ DLLs worked fine as soon as they were placed as mentioned.

EDIT: We have Unity Pro, so that’s not the problem ;).

And are you using the 32 bit version of libfftw3-3.dll? I had issues when I mistakenly used the 64 bit version of GDAL and it all cleared up when I switched to the 32 bit version. Assuming your Unity build is 32 bit.