[Gambas-user] external functions and structs

T Lee Davidson t.lee.davidson at gmail.com
Wed Nov 28 19:49:59 CET 2018


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.


More information about the User mailing list