Author Topic: Error if uncheck Prefer 32-bit  (Read 319 times)

noelquipit

  • Posts: 15
Error if uncheck Prefer 32-bit
« on: 26 Jul '19 - 03:32 »
Hi, I got error when i uncheck the Prefer 32-bit  on settings. I can't make it check due to it will conflict on my SqlLite code. Please see attached.

Falcosoft

  • Posts: 39
Re: Error if uncheck Prefer 32-bit
« Reply #1 on: 26 Jul '19 - 15:07 »
Hi,
Your problem is the 'Any CPU' platform target. If you think about it Any CPU (without prefer 32-bit) means that your .net executable behaves differently depending on what platform it runs. Namely it behaves like a 32-bit app on 32-bit OS and as a 64-bit app on 64-bit OS. But this behavior is not compatible with Bass libraries since Bass libraries are native dlls so they are either 32-bit or 64-bit explicitly. So if you copy the 32-bit bass.dll next to your executable it will work on 32-bit Windows but not on 64-bit Window and vice versa. So you should make a separate 32-bit executable for 32-bit Windows and a 64-bit executable for 64-bit Windows and copy the corresponding 32/64 bit Bass libraries next to them. Forget 'Any CPU' if you use Bass.

Ian @ un4seen

  • Administrator
  • Posts: 22253
Re: Error if uncheck Prefer 32-bit
« Reply #2 on: 26 Jul '19 - 15:20 »
I think it is possible to use the "Any CPU" platform setting if you also use the Bass.LoadMe method to load the correct BASS.DLL at runtime. But if you want to keep things simple and always use the same DLL(s) (this applies to all native libraries) then you should set the platform to x86 or x64 and put the corresponding DLL(s) alongside your EXE.

noelquipit

  • Posts: 15
Re: Error if uncheck Prefer 32-bit
« Reply #3 on: 29 Jul '19 - 02:50 »
Thanks to all who reply. Ill put this in mind. I'll try 32bit as my standard then check if it also work fine in 64bit.