Author Topic: BASS.NET loading libraries from custom path on Linux  (Read 81 times)

GTHvidsten

  • Posts: 12
BASS.NET core/standard versions have the LoadMe() method so that I can load bass.dll from another folder.
It seems that this method is missing in the linux version of BASS.NET.

So, how can I load libbass.so from another folder on linux?

radio42

  • Posts: 4727
Re: BASS.NET loading libraries from custom path on Linux
« Reply #1 on: 22 Nov '21 - 19:38 »
Yes, these methods doesn't exist on Linux, as there is no equivalent for it.

GTHvidsten

  • Posts: 12
Re: BASS.NET loading libraries from custom path on Linux
« Reply #2 on: 22 Nov '21 - 21:23 »
So that means the libbass.so file _must_ be in the same folder as all the other DLL-files for my application (except the Windows files which I _can_ place in other folders) ?

radio42

  • Posts: 4727
Re: BASS.NET loading libraries from custom path on Linux
« Reply #3 on: 23 Nov '21 - 20:07 »
Not sure about what you mean by the Windows files, but for all bass files and addons, these must be in the same folder as your executable yes.

GTHvidsten

  • Posts: 12
Re: BASS.NET loading libraries from custom path on Linux
« Reply #4 on: 23 Nov '21 - 20:29 »
By "Windows files" I mean that I can organize them in whatever folders I find the most tidy and use .LoadMe() to load BASS and plugins from these folders.

I can see there's an option in BASS.Net.Linux to load plugins from custom folders, so I guess I can organize plugins in folders as well... except the main Bass library (libbass.so) which must be in the same folder as the executable. Does that sound about right?

GTHvidsten

  • Posts: 12
Re: BASS.NET loading libraries from custom path on Linux
« Reply #5 on: 23 Nov '21 - 20:52 »
I tried using the BASS.Net.Linux library, running the application in Linux, and calling .GetVersion(), which now gives the following error:
libbass: cannot open shared object file: No such file or directory

Running the same application in Windows, using the BASS.Net.Standard library, works just fine.

Ian @ un4seen

  • Administrator
  • Posts: 23980
Re: BASS.NET loading libraries from custom path on Linux
« Reply #6 on: 24 Nov '21 - 14:32 »
Please post the full error message that you're getting. Also confirm if that's BASS_GetVersion or an add-on's GetVersion function that you're calling when the problem happens.

GTHvidsten

  • Posts: 12
Re: BASS.NET loading libraries from custom path on Linux
« Reply #7 on: 24 Nov '21 - 16:27 »
Full error message when calling Bass.BASS_GetVersion() in Bass.Net.Linux.dll:

DllNotFoundException: Unable to load shared library 'bass' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libbass: cannot open shared object file: No such file or directory

libbass.so is in the same folder as my main executable and Bass.Net.Linux.dll

Ian @ un4seen

  • Administrator
  • Posts: 23980
Re: BASS.NET loading libraries from custom path on Linux
« Reply #8 on: 24 Nov '21 - 17:35 »
Have you put the 32-bit or 64-bit libbass.so file alongside the executable? I believe it should match your Linux installation's architecture (most likely 64-bit these days). You can confirm which it is with the "file" tool.

GTHvidsten

  • Posts: 12
Re: BASS.NET loading libraries from custom path on Linux
« Reply #9 on: 24 Nov '21 - 17:56 »
Would you look at that... I completely missed there being an x64 folder inside the Bass Linux distribution. That fixed the load error. Thanks! :)

A followup question, though: libbass.so must reside in the same folder as the main executable, but plugins can be loaded from any folder using Bass.BASS_PluginLoad() or Bass.BASS_PluginLoadDirectory()? If that's the case, why can't also libbass.so be loaded like a plugin?

Ian @ un4seen

  • Administrator
  • Posts: 23980
Re: BASS.NET loading libraries from custom path on Linux
« Reply #10 on: 24 Nov '21 - 18:18 »
Plugins are loaded by BASS (in BASS_PluginLoad), so BASS needs to be loaded first, which means you can't load BASS itself that way :)

I'm not a .Net user myself, so I'm afraid I can't help much with the specifics of that, but in general the libbass.so file needs to be in the system's library search path (so the system can find it). If .Net provides the ability to add a folder to the library search path then it should be possible to have the libbass.so file in there instead.