Re: different struct sizes



You are using a library compiled on a platform other than what you are
using. You require libraries compiled for your platform (Same Hardware
and compiler options).

Certain platforms use 4 bytes memory for "char" and "short int"
variables. when you use 1 byte for char and 2 byte for short int on
your platform, this kind of problems are reported.

Regards,
Nagaraj L

On Nov 6, 6:58 am, Borked Pseudo Mailed <nob...@xxxxxxxxxxxxxxxxx>
wrote:
I have this weird problem with the JPEG library that I am using. There
is a function that is being called and one of the parameters being
passed is the length of a structure. Inside this function, the length
of the structure being passed is compared to the length of the same
structure calculated inside the function. Now because these values do
not match, the program exits.

======================

This is the prototype for this function:

jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, q(size_t) sizeof(struct
jpeg_decompress_struct));

======================

Now this is a portion of this function's code:

GLOBAL(void) jpeg_CreateDecompress (j_decompress_ptr cinfo, int version,
size_t structsize)
{
int i;

/* Guard against version mismatches between library and caller. */
cinfo->mem = NULL; /* so jpeg_destroy knows mem mgr not called
*/
if (version != JPEG_LIB_VERSION)
ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
if (structsize != SIZEOF(struct jpeg_decompress_struct))
ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,(int) SIZEOF(struct
jpeg_decompress_struct), (int) structsize);

======================

This is the error produced by this function:

JPEG parameter struct mismatch: library thinks size is 452, caller
expects 404

======================

Would anyone have any idea as to why something like this would happen?

Thanks

Reply

.



Relevant Pages

  • Re: integer size and portability-a wishful controversy
    ... >> BTW, there is no point in using the old Turbo C compiler, unless ... I do NOT consider programs relying on int having at least 32 bits as ... use the PC as an almost freestanding platform for developing/testing ... device drivers for various pieces of PC hardware. ...
    (comp.lang.c)
  • Re: Moving from C++ to VC++
    ... A long doesn't have to be wider than an int - it just can't be narrower. ... If there is more than one type that has the corresponding "maximally long hardware type", ... platform, those who will switch to that platform will fix breakage caused by the change? ... It was perceived by most to be necessary because the 16 bit platform was in _reality_ as well as in perception inadequate for the tasks at hand. ...
    (microsoft.public.vc.language)
  • Re: Moving from C++ to VC++
    ... If it is the longest integer. ... platform, I want the longest integer type ... Now /I/ would like to have 'int' being the ... Adhering to what computing standards' intention ...
    (microsoft.public.vc.language)
  • Re: I2C bus implementation (for MPC82xx)
    ... > PowerMac (see the patches that just went in rewriting the PowerMac i2c ... > smbus API, but then, do you really want to use an existing i2c driver? ... For the resources I have used platform definition. ... +static int ...
    (Linux-Kernel)
  • Re: Using OleDBParameter in a simple UPDATE statement
    ... apparently the SQL commands via the .NET OleDb objects w/MySQL are required ... Actually that is specific to the underlying database you are ... Also you might already know this, but an int to one ... > platform might be not an int some other platform. ...
    (microsoft.public.dotnet.framework.adonet)