JPEG support with ijg - getting access violation

前端 未结 7 1243
余生分开走
余生分开走 2021-01-06 12:00

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

7条回答
  •  伪装坚强ぢ
    2021-01-06 12:14

    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.

提交回复
热议问题