[Gambas-user] Working with .so library

Admin admin at allunix.ru
Fri Jul 26 02:37:28 CEST 2019


BTW, can Gambas point to an array? I mean, there's datatype in C called 
bytearray, and some of my .so library's procedures return or request a 
bytearray variable. Gambas can declare a Byte[] but can't VarPtr to it. 
So that's a no, right? Just making sure, it's not that important, but 
maybe there's a way?

26.06.2019 8:13, Admin пишет:
> So, I guess that's a no. It's kinda sad, but ok, minor issue.
>
> 25.06.2019 15:21, Admin пишет:
>> Ok, this question I have for a very long time now:
>> Sometimes I need to recieve a string variable from a library.
>> Usually it asks me to provide a pointer to a string where it would 
>> store it's output.
>> Problem is output is usually in WCHAR_T, while the string is always 
>> in UTF-8.
>> When I provide my strings to a library - it's not a problem, i just 
>> use Conv(MyString, "UTF-8", "WCHAR_T") and it's all ok.
>> But when I recieve a string from a library I rearly even know the 
>> lenght of the output I expect. But even if I do, that would be a 
>> lenght of a WCAHR_T string, and the size of UTF string would be 
>> defferent.
>> So in most cases if I recieve a string like this:
>>
>> libfptr_get_param_str(fptr, LIBFPTR_PARAM_MODEL_NAME, 
>> VarPtr(KKMmodel), stringsize)
>>
>> and then try to
>>
>> message(Conv(KKMmodel, "WCHAR_T", "UTF-8"))
>>
>> I will get a "bad string conversion".
>>
>> And I think it's totally fair, because, ok, I know that the string 
>> will be 18 chars long, but if I make KKMmodel declared as String and 
>> 18 chars long - is it even relevant?  It would be 18 UTF8 chars long, 
>> which has nothing to do with the lenght of WCHAR_T string.
>>
>> So, is there a way to correctly recieve WCHAR_T strings through 
>> pointers in Gambas?
>>
>> 25.06.2019 15:07, Tobias Boege пишет:
>>> On Tue, 25 Jun 2019, David Silverwood via User wrote:
>>>>> On Tuesday, June 25, 2019, 09:54:07 AM GMT+2, Benoît Minisini 
>>>>> <g4mba5 at gmail.com> wrote:
>>>>>     Le 25/06/2019 à 05:56, Admin a écrit :
>>>>>> Ok, answering my own question, it's easier then I thought. Gambas
>>>>>> actually allows the same enum declaration as C does, I mean I can 
>>>>>> use
>>>>>> multiple strings despite it's never mentioned in documentation. 
>>>>>> So it's
>>>>>> basically .h file copy-paste process, nothing more.
>>>>>>
>>>>> What is not mentioned in http://gambaswiki.org/lang/enumdecl ?
>>>>   i get a 404 error when trying to access that page?
>>> There's always a /wiki after the .org, which Benoît forgot.
>>>
>>
>>
>> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>>
>>
>>
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
>
>



More information about the User mailing list