[Gambas-user] Working with .so library

Benoît Minisini gambas at ...1...
Wed May 31 14:50:14 CEST 2017


Le 31/05/2017 à 14:36, Admin a écrit :
> 31.05.2017 18:18, Benoît Minisini пишет:
>> Le 31/05/2017 à 12:38, Admin a écrit :
>>> 31.05.2017 16:58, Benoît Minisini пишет:
>>>> Apparently all that black box is written in C++ with QT, and without 
>>>> the header of the library interface , I can't tell you if it is 
>>>> possible to use the library with Gambas, and how.
>>>>
>>>> Regards,
>>>>
>>> I was lucky enough to find the header file shared by developers and 
>>> an example program in C++ that utilizes this lib.
>>>
>>> Here they are: http://allunix.ru/back/atol-header.tar.gz
>>>
>>
>> Maybe CreateFptrInterface() is a C++ only thing, and that you must 
>> call another function from the C interface to do something similar. 
>> But I couldn't find it reading the C header.
>>
>> You need the documentation of the C interface, or at least an example 
>> written in C to know. You usually can't use C++ exported functions 
>> from Gambas.
>>
>> Regards,
>>
> Maybe it is. One of the authors of the original .so library stated on 
> one forum:
> 
> "You can use purely C interface like this:
> 
> void *fptr = CreateFptrInterface();
> put_DeviceSingleSetting(fptr, L"Port", "4");
> ApplySingleSettings(fptr);
> 
> "
> 
> but I can't see the difference.
> 
> 
> Dmitry.
> 

Then it should work the way you did. But you did not respect the 
interface of put_DeviceSingleSettingAsInt(). It wants a "wchar_t *", 
whereas the Gambas strings are encoded in ASCII or UTF-8.

You must first convert the Gambas string to wchar_t by using 
Conv$(<string>, "UTF-8", "WCHAR_T") or Conv$(<string>, "ASCII", "WCHAR_T").

Regards,

-- 
Benoît Minisini




More information about the User mailing list