This is indeed very strange. I am not a Linux user myself. But here are the signatures of BassEnc as well as the BassEnc_Mp3 add-on. Both are 100% identical, as such, I do not see any reason, why the _GetVersion call would succeed on BassEnc, but fail on BassEnc_Mp3:
1: BassEnc:
[DllImport("bassenc")]
public static extern int BASS_Encode_GetVersion();
2: BassEnc_Mp3:
[DllImport("bassenc_mp3")]
public static extern int BASS_Encode_MP3_GetVersion();
Note, as Ian suggested to remove the call to BASS_PluginLoad(path) as this is not intended to load the encoder add-ons.
Maybe you can simply your test to:
var ver = BassEnc.BASS_Encode_GetVersion();
var err = Bass.BASS_ErrorGetCode();
var ver1 = BassEnc_Mp3.BASS_Encode_MP3_GetVersion();
var err1 = Bass.BASS_ErrorGetCode();
when calling the code example you said, ver=2.4.15.0 , err=BASS_OK
when it comes to ver1 , it fails and gives the error :Unable to load shared library 'bassenc_mp3' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libbassenc_mp3: cannot open shared object file: No such file or directory
and not continues the next line err1
one interesting thing i found that, if you call
var initresult = Bass.BASS_Init(_soundCard, _frequency, _initFlags, IntPtr.Zero);
var ver1 = BassEnc.BASS_Encode_GetVersion(4); //this gives the same kind error..
var err1 = Bass.BASS_ErrorGetCode();
ver1 gives the same kind error ('Unable to load shared library 'bassenc' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libbassenc: cannot open shared object file: No such file or directory')
but if you put a mixer after bass init, BassEnc.BASS_Encode_GetVersion(4) works..
var initresult = Bass.BASS_Init(_soundCard, _frequency, _initFlags, IntPtr.Zero);
var mixer= BassMix.BASS_Mixer_StreamCreate(44100, 2, BASSFlag.BASS_DEFAULT);//if you put this
var ver1 = BassEnc.BASS_Encode_GetVersion(4); //now it works.
var err1 = Bass.BASS_ErrorGetCode();
var ver2 = BassEnc_Mp3.BASS_Encode_MP3_GetVersion(); //this still not works..
var err2 = Bass.BASS_ErrorGetCode();
so i think, from now, ian have to check it..
ps: radio42, do you have wsl/wsl2 on your windows 10/11?
you can easily test it.. after wsl or wsl2 install , install ubuntu20 to wsl.. then open visual studio 2022, create a dotnet core console app or dotnet standart dll + dotnet core app,
when you press dropdown button near run, you will see wsl2 option.. it will directly start debugging on ubuntu.. i tested on real ubuntu , wsl, wsl2, console etc.. all same..