C Programming -- sizeof LSHandle struct


#1

Since struct LSHandle has been defined in base.h, developer could not get the size of it by sizeof keyword or I don't know the way. It is typedef'ed in lunaservice.h, but compiler(especially GCC) cannot figure the size of it out with incomplete type (typedef). Is it possible to get it on the current implementation of Luna-service2 or are there ways? I need to size of it for implementing a library.

For example, this is impossible.

#include <luna-service2/lunaservice.h>

(LSHandle *)malloc(sizeof(LSHandle)*1);

Thank you in advance. :slight_smile:


#2

I just figured out that was an Opaque data type. But still looking for the solution.