Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 64
Registered: ‎02-21-2012
My Device: Blackberry Playbook
My Carrier: None
Accepted Solution

netstatus example

Again, I am playing around with the netstatus example.  I am continuing with trying to access the interface details using:


typedef struct netstatus_interface_details_t netstatus_interface_details_t;


and this


int netstatus_get_interface_details(const char *interface, netstatus_interface_details_t **details);


When I try to allocate the structure on the stack I get the following error:


netstatus_interface_details_t details[10];  // error: array type has incomplete element type


What am I missing?


Something like this 


struct TestStruct
char a[20];
int b;

typedef struct TestStruct TestStruct;

TestStruct Array[10];


compiles fine with gcc


Aside: I just chose 10 because it is bigger than the number of interfaces found previously.

Posts: 38
Registered: ‎10-26-2011
My Device: BlackBerry Bold 9900
My Carrier: Rogers

Re: netstatus example

netstatus_interface_details_t is an opaque struct.  Its contents are not declared in the header file so the compiler doesn't know its size.  You use it like:


    netstatus_interface_details_t* details;
    int rc = netstatus_get_interface_details(interface, &details);
    if (rc != BPS_SUCCESS) {

        /* handle error */
    } else {

        /* use getter functions on the details struct e.g. */

        const char * name = netstatus_interface_get_name(details);

        /* free it when done */




Its defined this way so that adding additional members to the interface details doesn't break backwards compatibility.  netstatus_interface_list_t behaves differently because we don't see it changing in the future.


Posts: 64
Registered: ‎02-21-2012
My Device: Blackberry Playbook
My Carrier: None

Re: netstatus example

Thank you very much.