Imagination PowerVR SDK Blog

Issue with PVRTexLib (class CPVRTextureHeader)



I have an issue with the use of PVRTexLib, more precisely with the constructor of the class CPVRTextureHeader. I'm using Visual Studio 2003, i've installed PVRTexLib.dll, include headers, define _WINDLL_IMPORT as described in the manual.

I can use CPVRTexture class, i don't have problem, so, for me, i've well installed the library.  But i can't create an instance of the CPVRTextureHeader, the application compiles but i obtain a microsoft error during the creation of the "*.exe" (" "*.exe" has encountered a problem and must close ...")


Here is the code :



// TestEncodeIntoPVR


#include <iostream>

using namespace std;

#define _WINDLL_IMPORT 1

#include "Include/PVRTexLib.h"

using namespace pvrtexlib;

const char g_TexFilePVR[] = "Picture/Mallet.pvr";

int main()




FILE* p_pvrFile = fopen(g_TexFilePVR, "rb");

CPVRTextureHeader* p_textureHeader = NULL;

if (p_pvrFile != NULL)


// issue with CPVRTextureHeader constructor

p_textureHeader = new CPVRTextureHeader(p_pvrFile);





printf("Exception : %s",myException.what());



return 0;


//// end TestEncodeIntoPVR

If you have a solution, i'll be happy :-)

Thank you.


I’m not entirely sure what is happening here - I can’t immediately see anything wrong with what you are doing.

I’ve filed a bug (BRN27065) and will report back when I know more.


Thank you for your reply.


Just to summarize, it's an issue with the constructor of CPVRTextureHeader class, more precisely :

CPVRTextureHeader(FILE *const fFile);

Make my test with Visual Studio, you'll see the result. Perhaps, it's a problem with the implementation of this constructor, it's a FILE *const fFile. In the implementation of this constructor, you may have modified the value of the pointer fFile which must stay constant.



Hi pascal,

Not sure if you’re still around, and I’m sorry this has taken so long, but I’ve now taken over this bug and have tested the problem in the current SDK (2.7) and found it not to be an issue. If you have any other queries or find this problem still appears for you with the latest SDK release please don’t hesitate to reply.