scala-native / scala-native-bindgen

Scala Native Binding Generator

Home Page:https://scala-native.github.io/scala-native-bindgen/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use union members

IbrahimaWane opened this issue · comments

Hello,
I have a lot of C code to convert to Scala-native - a library actually.
However, some of the types are not correctly generated. This is an example:

typedef struct iodbto {
    short   datano_s ;
    short   type ;   
    short   datano_e ; 
    union {
        long    m_ofs[5] ;     
        long    m_ofs_a[5] ;   
        long    m_ofs_b[10] ;   
        long    m_ofs_c[20] ;   
        struct  {
            short   tip ; //THIS GUY for example, is not accessible through the **_N** 
            long    data[1] ;
        } m_ofs_at[5] ;       
        struct  {
            short   tip ;
            long    data[2] ;
        } m_ofs_bt[5] ;         
        struct  {
            short   tip ;
            long    data[4] ;
        } m_ofs_ct[5] ;         
        short   t_tip[5] ;     
        long    t_ofs[5] ;     
        struct  {
            short   tip ;
            long    data[4] ;
        } t_ofs_a[5] ;       
        struct {
            short   tip ;
            long    data[8] ;
        } t_ofs_b[5] ;        
        long    t_ofs_2g[15];  
        long    m_ofs_cnr[10];  
        struct  {
                long    data[2];
        } t_ofs_ex[5];		   
    } u ;   
} IODBTO ;

Without using the generated implicit classes, I cannot access the variables inside the structs in the union.
As for using the implicits, some parts are not correctly generated:

screenshot1