Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 143261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:04:03+00:00 2026-05-11T08:04:03+00:00

I was recently trying to update my game to store graphics in compressed formats

  • 0

I was recently trying to update my game to store graphics in compressed formats (JPEG and PNG).

Whilst I ended up settling on a different library, my initial attempt was to incorporate ijg to do JPEG decompression. However, I was unable to get even the simplest console application to work and am wondering if anyone might be able to shed some light on the reasons why.

Here is my code, which is linked to the jpeg.lib that is part of the ijg packages:

#include 'stdafx.h' #include <stdio.h> #include <assert.h> #include <jpeglib.h>  int _tmain(int argc, _TCHAR* argv[]) {     struct jpeg_decompress_struct cinfo;     struct jpeg_error_mgr jerr;     JSAMPARRAY buffer;     int row_stride;      //initialize error handling     cinfo.err = jpeg_std_error(&jerr);      //initialize the decompression     jpeg_create_decompress(&cinfo);      FILE* infile;     errno_t err = fopen_s(&infile, '..\\Sample.jpg', 'rb');     assert(err == 0);      //specify the input     jpeg_stdio_src(&cinfo, infile);      //read headers     (void) jpeg_read_header(&cinfo, TRUE);      return 0; } 

The problem is that the call to jpeg_read_header() fails with an access violation:

Unhandled exception at 0x7c91b1fa (ntdll.dll) in JPEGTest.exe: 0xC0000005: Access violation writing location 0x00000010.

Does anyone have any ideas what I might be doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:04:03+00:00Added an answer on May 11, 2026 at 8:04 am

    I’ve just encountered the same problem (although I was trying to encode an image). Apparently, FILE* are not portable between DLLs so you can’t use any libjpeg API that takes a FILE* as a parameter.

    There are several solutions, but they all come down to having to rebuild the library:

    • Build the library as a static lib, and link it to your application. This is what I did, and it solved my problem.
    • Move the source/destination handlers out of libjpeg and into your application. Then you could build libjpeg as either a static lib or a DLL, whichever suits you. I’m not sure whether this would work, but it is the suggested solution in the ‘install.doc’ file distributed with the source code.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A problem I recently ran into was that when trying to update a field
Recently, I was trying to optimise this query UPDATE Analytics SET UserID = x.UserID
recently I have been trying my hand at coding a game in C#. I'm
I was trying to update the Recently Changed App by adding the columns that
Recently, my Eclipse 3.4 installation started complaining while trying to update installed software. I
I was recently trying to re-install the fos:userbundle and noticed the docs have changed.
I have been recently trying to deploy a C# application on a computer that
I've recently being trying to teach myself how parsers (for languages/context-free grammars) work, and
I've recently been trying to port a C++ application. I believe I have all
I've recently been trying to learn me a Haskell, and I'd like to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.