🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.graphics.algorithms
Article #20

Re: IJG JPEG Engine and Win32

#20
From: Tom Lane
Date: Thu, 04 Jan 1996 04:25
37 lines
2433 bytes
fortunat@interpath.com (Jumpstile Turner) writes:
> Hi all.  Has anyone successfully compiled and linked the IJG JPEG engine
> with a Win32 compiler?  I can compile it fine and the resulting LIB file
> works great when linking it into the included test applications; however, if
> I try to link it with my GUI apps I get some really odd errors.

I can tell you what's probably going on here: structure interpretation
mismatch, ie, the IJG library thinks the offsets of fields inside the
cinfo struct are different from what your surrounding application thinks.

Windoze applications seem to be particularly prone to this kind of
problem.  I can name two possible causes right off the bat:
  * Compiling library and calling app with different structure packing
    rules (#pragma pack or the equivalent compiler switch).
  * Compiling them with different declarations for "boolean".  The IJG
    code by default defines boolean = int, but Windows prefers
    boolean = unsigned char.  Theoretically you should get a compile
    error if both typedefs are visible in one compilation, but maybe
    Borland fails to complain about it.

If neither of those explain your problem, you'll have to do some more
digging, but I'll bet lunch that the problem is of this general ilk.

Your debugger is probably using symbol table entries generated by the
surrounding program, BTW.

This sort of problem has been reported enough times that the next release
of the IJG code will include defenses against it: if the library's idea
of sizeof(cinfo) doesn't match the application's, you'll get an immediate
failure exit with a specific error message.  This will be in v6a which 
I hope to have out in a week or two.

If you find that the problem is *not* a structure mismatch, but has some
other root, I'd appreciate receiving the details at jpeg-info@uunet.uu.net.

			regards, tom lane
			organizer, Independent JPEG Group
Technical Details
Message-ID: <TGL.96Jan3202549@netcom21.netcom.com>
Path: arc1-ca.pugleaf.net!netcom.com!tgl
References: <4cemir$6vb@redstone.interpath.net>

Show Full Headers
Complete Article Headers
Newsgroups: comp.graphics.algorithms,comp.lang.c++,comp.os.ms-windows.programmer.graphics,comp.os.ms-windows.programmer.multimedia,comp.os.ms-windows.programmer.win32
Path: arc1-ca.pugleaf.net!netcom.com!tgl
From: tgl@netcom.com (Tom Lane)
Subject: Re: IJG JPEG Engine and Win32
Message-ID: <TGL.96Jan3202549@netcom21.netcom.com>
Sender: tgl@netcom21.netcom.com
Organization: Netcom Online Communications Services
References: <4cemir$6vb@redstone.interpath.net>
Date: Thu, 4 Jan 1996 04:25:48 GMT