[Gambas-user] external functions and structs

gen braga genbraga1 at gmail.com
Thu Nov 29 16:21:45 CET 2018


Sure... I made that dumb mistake and I was so absorbed looking elsewhere
that i didn't realize... thanks for pointing that.

By the way, the Gambas compiler didnt tell anything about the missing
"Struct" keyword. Is that the expected behavior? I mean, maybe could be a
legitimate reason?

Em qua, 28 de nov de 2018 às 16:51, T Lee Davidson <t.lee.davidson at gmail.com>
escreveu:

> Try this:
>
> Public Struct AIS_State
>     msgid As Byte                               'Message ID 0 - 31
>     sequence As Short                         'era DWORD; / / ! < VDM
> message sequence number
>     total As Short                            'era DWORD; / / ! < Total #
> Of parts For the message
>     num As Short                              'era DWORD; / / ! < Number
> Of the Last part stored
>     channel As Byte                             ': Char; / / ! < AIS
> Channel character
>     six_state As Struct SixBit                         '; / / ! < sixbit
> parser state
> End Struct
>
> Notice: six_state As *Struct* SixBit
>
> http://gambaswiki.org/wiki/lang/structdecl -> Embedded Structures
>
>
> ___
> Lee
>
>
> On 11/28/18 1:09 PM, gen braga wrote:
> > Well, i have some notes,
> >
> > 1. I tried to chage P in sixbit to every suitable datatype: byte,
> string, pointer, etc. No good.
> > 2. I "unested" the structs, so I got no segfault but obviously I still
> cant get any suitable value in ais_state1 after I call
> > the method assemble_vdm. By "unested" I mean I made only one struct with
> both contents. If you look at the contents using the
> > debuger, there will be garbage.
> >
> > You can check assemble_vdm is ok by changing any character in the
> sSentence string, so Handler will return something between 1
> > and 5, based on wich field  was changed. By using the debuger you can
> see it cleary, as well as the mess at ais_state1.
> >
> > I really have no clue...
> >
> > The library's authors made a simple example here
> https://github.com/bcl/aisparser/blob/master/c/examples/text/main.c but
> it does
> > nothing more than my souces at all.
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20181129/b13fe591/attachment.html>


More information about the User mailing list