Hi,
I am writing a simple JPEG encoder application, linking to the pre-built libjpgenc.a delivered with DVSDK.
It turns out that C structs are packed differently between my own ARM code and the pre-built libjpgenc.a, which means that I need to convert structures when passing between my code and the pre-built library, or change my compilation to match that used by the library. I'd like to know if there is a recommended way of going about this.
For example take the IALG_MemRec structure:
typedef struct IALG_MemRec {
Uns size;
Int alignment;
IALG_MemSpace space;
IALG_MemAttrs attrs;
Void *base;
} IALG_MemRec;
My own ARM compilation treats the enums IALG_MemSpace and IALG_MemAttrs as single bytes, which are packed into a single longword in the structure, and the total structure size is 16 bytes. However when ALG_create() calls JPEGENC_TI_alloc() within the library, the library treats it as a 20 byte structure, with each enum aligned on a longword boundary. This means that I must convert the data returned by JPEGENC_TI_alloc() to the 16-byte sized structure layout used by the rest of the code.
The same will presumably apply to other structures passed between my ARM code and libjpgenc.a. Rather than have to individually modify each of these calls and convert between struct-layouts (and for all other codecs as well as JPEG too), is there a standard way of doing this? I did not find anything within the DVSDK that looks like it dealt with this conversion, does the DVSDK always compile the application code with non-standard GCC structure-packing options, or perhaps different short-enum options?
Any hints on the standard way of approaching this would be appreciated. Thanks. FYI: this is a non-Linux environment, using a proprietary RTOS but standard GCC tools.