[Interest] Bluetooth library and old windows versions

Oliver Wolff Oliver.Wolff at qt.io
Fri Aug 24 07:39:05 CEST 2018


On 23/08/2018 16:38, maitai wrote:
> Ok, so if I understand well windows will show the cryptic message only 
> when trying to actually use the library? Because it seems to me that 
> if Qt is able to display a message then the lib loaded successfully 
> from Windows point of view, even if unusable, no? Here the BT feature 
> is really optional and is eventually activated only after many other 
> checks and settings, never during app loading.

No the message is shown in the library's main entry point function. That 
function is run while the dll is being loaded. We just hook in there to 
be able to show a "proper" error message and return instead of getting a 
cryptic error message and a terminating app. So the library is not 
loaded successfully by Windows at that point in time. Any hints about 
how to solve that problem differently are of course welcome :)

Olli

>
> I will disable BT on Windows platforms for the time being.
>
> Philippe.
>
> Le 23-08-2018 15:41, Oliver Wolff a écrit :
>> No the message comes from Qt not Windows (and we call exit(-1))
>> <qtconnectivity>\src\bluetooth\qbluetoothutils_win.cpp. If we would
>> not show the message, windows would show a more cryptic error message
>> if I remember correctly.
>>
>>
>> On 23/08/2018 15:34, Maurice Kalinowski wrote:
>>> The message resides from Windows as it is not able to resolve all 
>>> dependencies and hence the application is not launched at all.
>>>
>>> Plugins getting loaded is an API call at runtime, which simply 
>>> returns a nullptr and you could add error handling to this. So there 
>>> is no system dialog involved or such.
>>> Hence this is a valid workaround. However, as Olli mentioned, you 
>>> then need to resolve all functions you need.
>>>
>>> BR,
>>> Maurice
>>>
>>>
>>> -----Original Message-----
>>> From: Interest 
>>> <interest-bounces+maurice.kalinowski=qt.io at qt-project.org> On Behalf 
>>> Of maitai
>>> Sent: Thursday, August 23, 2018 3:32 PM
>>> To: interest at qt-project.org
>>> Subject: Re: [Interest] Bluetooth library and old windows versions
>>>
>>> Hi Oliver, thanks for your reply
>>>
>>> This message is from Qt or from Windows? Because if it is from Qt 
>>> then maybe it is worth adding a "compatibility-check" method and let 
>>> the developer decide if it is fatal or not?
>> We could mirror the dummy plugin's behavior in this case, but that
>> would mean a lot of ifdefery in the windows code. Not sure about the
>> compatibility check, because the problem is that loading the dll will
>> fail on runtime on an older Windows version (as mentioned above).
>>>
>>> Otherwise I will go with yet another build and install option I think.
>>> The plugin method will probably display the message each time the 
>>> app is launched and that is annoying.
>>>
>>> Philippe
>>>
>>>
>>> Le 23-08-2018 15:00, Oliver Wolff a écrit :
>>>> Hi,
>>>>
>>>>
>>>> On 23/08/2018 13:30, maitai wrote:
>>>>> Hello,
>>>>>
>>>>> I have a problem with users equipped with an old version of Windows
>>>>> (8, or 7). The latest version of my app (Qt 5.11.1/MSVC 2017 based)
>>>>> required QtBluetooth but when users load the app they get a message
>>>>> saying:
>>>>>
>>>>> "This Windows version does not support the required Bluetooth API.
>>>>> Consider updating to a more recent Windows (10.0.10586 or above)"
>>>>>
>>>>> Then they press OK and the app shuts down.
>>>>>
>>>>> I understand the message and have no problem removing BT
>>>>> functionalities for these users with old Windows versions, but my
>>>>> question is: can I avoid to build several binaries, i.e. is there a
>>>>> way not to load QtBluetooth if windows version is not recent enough ?
>>>>> Any other suggestion ?
>>>> The message is shown when the dll is loaded, so unfortunately I only
>>>> see two other ways of working around the problem.
>>>> 1) You could try to dlopen the library and lazy load all the
>>>> functionality you need. That would mean, that you have to resolve
>>>> every function though...
>>>> 2) You could put your Bluetooth code into a plugin. If that fails to
>>>> load, the application will not exit immediately, but only the plugin
>>>> loading will fail then.
>>>>> Thanks
>>>>> Philippe.
>>>>>
>>>>>
>>>> BR,
>>>> Olli
>>>>> _______________________________________________
>>>>> Interest mailing list
>>>>> Interest at qt-project.org
>>>>> http://lists.qt-project.org/mailman/listinfo/interest
>>>> _______________________________________________
>>>> Interest mailing list
>>>> Interest at qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/interest
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list