jpeg_stdio_dest not being found on windows build

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
mattywix
Posts: 15
Joined: Wed, 2011-03-30, 15:31

jpeg_stdio_dest not being found on windows build

#1 Post by mattywix »

Hi

Im building some custom code around your library. On Linux it works fine.
Under windows it doesnt call the correct jpeg_stdio_dest - when I try debug it doesnt seem to be calling anything.
Its as if it didnt see my implementation of jpeg_stdio_dest.
Why would this problem only happen on windows.

Im using visual studio C++ express 2010

Thanks and apologies if you consider this to be an IJG question.
I can reopen on their forums if you wish.

mattywix
Posts: 15
Joined: Wed, 2011-03-30, 15:31

#2 Post by mattywix »

Could this have something to do with "HAVE_PROTOTPYES" and __cdecl ?

Uli Schlachter
DCMTK Developer
Posts: 120
Joined: Thu, 2009-11-26, 08:15

#3 Post by Uli Schlachter »

Hi,

what are you doing exactly? Am I right to assume that you are trying to replace jpeg_stdio_dest with your own version? Why?

Who is "it" in "it doesn't seem to be calling anything"? Do you mean that none of the several jpeg_stdio_dest() is called?

Uli

mattywix
Posts: 15
Joined: Wed, 2011-03-30, 15:31

#4 Post by mattywix »

I have a new jpeg_stdio_dest. Why? because the current one used file handles instead of streams so is very inflexible.

When I run the debugger and try to step into jpeg_stdio_dest it just jumps straight over as if the function pointer is null.

It seems that it isnt linking to the jpeg_stdio_dest and I assume the whole extern defiiniton thing isnt working in my windows build.

I can create a wrapper extern function in the same source file as jpeg_stdio_dest and that works perfectly ok!

So my destination manager now has

Code: Select all

GLOBAL(void)
jpeg_stdio_dest_wrapper (j_compress_ptr cinfo, FILE * outputbuffer)
{
	return jpeg_stdio_dest (cinfo, outputbuffer);
}

And the plugin now has

Code: Select all

extern void jpeg_stdio_dest_wrapper (j_compress_ptr cinfo, FILE * outputbuffer);
...
int DiJPEGPluginRhapsody::write(DiImage *image,
                        FILE *outputbuffer,
						//signed char **stream, "error: cannot declare variable ‘plugin’ to be of abstract type"
                        const unsigned long frame) const
{
...
#ifdef HAVE_WINDOWS_H
			// get around windows linking wierdness by a simple forced hack
			jpeg_stdio_dest_wrapper(&cinfo, (FILE *)outputbuffer);
#else
            jpeg_stdio_dest(&cinfo, (FILE *)outputbuffer);
#endif
but nothing I can do will get it to see the jpeg_stdio_dest method - I think the definition in jpeglib8.h is messing things up somehow.

Uli Schlachter
DCMTK Developer
Posts: 120
Joined: Thu, 2009-11-26, 08:15

#5 Post by Uli Schlachter »

jpeglib12.h contains this:

Code: Select all

#define jpeg_stdio_dest                jpeg12_stdio_dest
So perhaps you missed this little magic and are calling a function that doesn't exist?

(This hack exists to make it possible for the 8bpp, 12bpp and 16bpp versions to co-exist)

mattywix
Posts: 15
Joined: Wed, 2011-03-30, 15:31

#6 Post by mattywix »

Thanks for the tip, but yes we have that for jpeg8.

I tried to hardcode the define in case it was missed:
#define jpeg_stdio_dest jpeg8_stdio_dest

And I also tried changing the method name to have the '8' but in all cases the windows build isnt linking the method in.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest