Author Topic: DllNotFoundException when trying to use Bass.Net  (Read 301 times)

Vibrance

  • Posts: 6
Hello!
I've been using Bass.Net for a long time now, and I've decided to include x64 support. I followed the instructions of this guide, but now every time my application makes a call to Bass it crashes with a "DllNotFoundException".
I am initializing Bass and all addons like this, and of course before any other call to Bass:
Code: [Select]
string targetPath;
if (Utils.Is64Bit)
    targetPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "x64");
else
    targetPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "x86");

Bass.LoadMe(targetPath);
BassMix.LoadMe(targetPath);
BassFx.LoadMe(targetPath);

And yes, I've put the correct native bass libraries in the correct folders.
I hope someone can help me with this :)

radio42

  • Posts: 4576
Re: DllNotFoundException when trying to use Bass.Net
« Reply #1 on: 4 Sep '17 - 07:25 »
Which call causes the dll not found exception and have you checked, the the needed native dall is indeed present at the given path?

Ian @ un4seen

  • Administrator
  • Posts: 20426
Re: DllNotFoundException when trying to use Bass.Net
« Reply #2 on: 4 Sep '17 - 17:02 »
If you haven't already done so, also check that the "targetPath" variable is pointing to the correct folder, eg. by logging it or checking it in the debugger.

Vibrance

  • Posts: 6
Re: DllNotFoundException when trying to use Bass.Net
« Reply #3 on: 5 Sep '17 - 22:03 »
I just found out why it hasn't worked: Unfortunately the Bass.Net documentation showed the method to load those libraries wrong, I just appended the filename and it works!
My call looks now like this:

Code: [Select]
string targetPath;
if (Utils.Is64Bit)
    targetPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "x64");
else
    targetPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "x86");

Bass.LoadMe(targetPath + "//bass.dll");
BassMix.LoadMe(targetPath + "//bassmix.dll");
BassFx.LoadMe(targetPath + "//bass_fx.dll");

Edit: Nevermind, I have forgotten to remove the native libraries from the base directory, it still doesn't work (although the x64 libraries are in the x64 folder and x86 libraries in x86)
« Last Edit: 5 Sep '17 - 22:26 by Vibrance »

radio42

  • Posts: 4576
Re: DllNotFoundException when trying to use Bass.Net
« Reply #4 on: 6 Sep '17 - 13:33 »
The Bass.Net doc is correct, as the native executable is added automatically (internally it uses Path.Combine).

Please check, if the LoadMe call actually returns TRUE ?!

Vibrance

  • Posts: 6
Re: DllNotFoundException when trying to use Bass.Net
« Reply #5 on: 8 Sep '17 - 15:05 »
Okay I don't know why, but the method in my first post works now. Thanks for the support :)