# PVRTexLib crashes on 64-bit

**URL:** <https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364>\
**Category:** PowerVR Insider\
**Created:** [September 12, 2015, 2:04am UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364 "2015-09-12T02:04:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![esenthel](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/esenthel/32/18_2.png) [@esenthel](https://forums.imgtec.com/u/esenthel)\
**Post date:** [September 12, 2015, 2:04am UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/1 "2015-09-12T02:04:38Z")

</div>

latest version crashes when I try to create ETC2/PVRTC textures

Crash occurs only on 64-bit!  
32-bit works fine

It crashes here:  
[pre] ~MetaDataBlock[]  
{  
if [Data]  
delete [] Data;  
Data = NULL;  
}[/pre]

I’m executing with this code:  
[pre]Bool CompressPVRTC2[Int x, Int y, Ptr data, Int type, Int quality, Ptr &compressed\_data, Int &compressed\_size]  
{  
compressed\_data=NULL;  
compressed\_size=0;

using namespace pvrtexture;  
CPVRTextureHeader header[PVRStandard8PixelType.PixelTypeID, y, x];  
CPVRTexture texture[header, data];

if[Transcode[texture, EPVRTPixelFormat[type], ePVRTVarTypeUnsignedByteNorm, ePVRTCSpacelRGB, ECompressorQuality[quality], false]] // dithering makes smooth gradients [like sky] very bad so always disable them  
{  
Ptr data=texture.getDataPtr [];  
Int size=texture.getDataSize[];  
if[data && size\>0]  
{  
memcpy[compressed\_data=malloc[size], data, compressed\_size=size];  
return true;  
}  
}  
return false;  
}[/pre]

---

<div class="post-metadata">

**Author:** ![esenthel](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/esenthel/32/18_2.png) [@esenthel](https://forums.imgtec.com/u/esenthel)\
**Post date:** [September 12, 2015, 2:57am UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/2 "2015-09-12T02:57:20Z")

</div>

Also, please note that I’m using Visual Studio 2015.

And had to define the missing symbols manually:

[pre]  
#ifdef \_WIN32 // TODO: check if in the future this entire block can be removed once a new version of PVRTexLib is released  
#define \_NO\_CRT\_STDIO\_INLINE  
#include \<stdio.h\>  
#include \<corecrt\_wstdio.h\>  
extern “C” FILE\* \_\_iob\_func[unsigned i] {return \_\_acrt\_iob\_func[i];}  
int \_vsnprintf\_l[char\* const \_Buffer, size\_t const \_BufferCount, char const\* const \_Format, \_locale\_t const \_Locale, va\_list \_ArgList]  
{  
int const \_Result = \_\_stdio\_common\_vsprintf[\_CRT\_INTERNAL\_LOCAL\_PRINTF\_OPTIONS | \_CRT\_INTERNAL\_PRINTF\_LEGACY\_VSPRINTF\_NULL\_TERMINATION, \_Buffer, \_BufferCount, \_Format, \_Locale, \_ArgList];  
return \_Result \< 0 ? -1 : \_Result;  
}  
int \_vscprintf\_l[char const\* const \_Format, \_locale\_t const \_Locale, va\_list \_ArgList]  
{  
int const \_Result = \_\_stdio\_common\_vsprintf[\_CRT\_INTERNAL\_LOCAL\_PRINTF\_OPTIONS | \_CRT\_INTERNAL\_PRINTF\_STANDARD\_SNPRINTF\_BEHAVIOR, NULL, 0, \_Format, \_Locale, \_ArgList];  
return \_Result \< 0 ? -1 : \_Result;  
}  
int \_vsprintf\_p\_l[char\* const \_Buffer, size\_t const \_BufferCount, char const\* const \_Format, \_locale\_t const \_Locale, va\_list \_ArgList]  
{  
int const \_Result = \_\_stdio\_common\_vsprintf\_p[\_CRT\_INTERNAL\_LOCAL\_PRINTF\_OPTIONS, \_Buffer, \_BufferCount, \_Format, \_Locale, \_ArgList];  
return \_Result \< 0 ? -1 : \_Result;  
}  
int \_vscprintf\_p\_l[char const\* const \_Format, \_locale\_t const \_Locale, va\_list \_ArgList]  
{  
int const \_Result = \_\_stdio\_common\_vsprintf\_p[\_CRT\_INTERNAL\_LOCAL\_PRINTF\_OPTIONS | \_CRT\_INTERNAL\_PRINTF\_STANDARD\_SNPRINTF\_BEHAVIOR, NULL, 0, \_Format, \_Locale, \_ArgList];  
return \_Result \< 0 ? -1 : \_Result;  
}  
int \_vsnprintf[char\* const \_Buffer, size\_t const \_BufferCount, char const\* const \_Format, va\_list \_ArgList] {return \_vsnprintf\_l[\_Buffer, \_BufferCount, \_Format, NULL, \_ArgList];}  
int \_vscprintf[char const\* const \_Format, va\_list \_ArgList] {return \_vscprintf\_l[\_Format, NULL, \_ArgList];}  
int \_vsprintf\_p[char\* const \_Buffer, size\_t const \_BufferCount, char const\* const \_Format, va\_list \_ArgList] {return \_vsprintf\_p\_l[\_Buffer, \_BufferCount, \_Format, NULL, \_ArgList];}  
int \_vscprintf\_p[char const\* const \_Format, va\_list \_ArgList] {return \_vscprintf\_p\_l[\_Format, NULL, \_ArgList];}  
int vsprintf[char\* const \_Buffer, char const\* const \_Format, va\_list \_ArgList] {return \_vsnprintf\_l[\_Buffer, [size\_t]-1, \_Format, NULL, \_ArgList];}  
int vfprintf[FILE\* const \_Stream, char const\* const \_Format, va\_list \_ArgList] {return \_vfprintf\_l[\_Stream, \_Format, NULL, \_ArgList];}  
int vprintf[char const\* const \_Format, va\_list \_ArgList] {return \_vfprintf\_l[stdout, \_Format, NULL, \_ArgList];}  
#endif[/pre]

---

<div class="post-metadata">

**Author:** ![esenthel](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/esenthel/32/18_2.png) [@esenthel](https://forums.imgtec.com/u/esenthel)\
**Post date:** [September 12, 2015, 3:20am UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/3 "2015-09-12T03:20:06Z")

</div>

I’ve just verified this and when I compile with VS 2013 toolset, then it works OK.

So please add support for VS 2015, thanks!

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [September 14, 2015, 2:38pm UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/4 "2015-09-14T14:38:04Z")

</div>

Hi Greg,

Are you using the PVRTexLib dynamic library or the static one? We’re planning to deprecate the static library in future releases due to the maintenance cost of supporting multiple versions of Visual Studio.

---

<div class="post-metadata">

**Author:** ![esenthel](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/esenthel/32/18_2.png) [@esenthel](https://forums.imgtec.com/u/esenthel)\
**Post date:** [September 14, 2015, 9:56pm UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/5 "2015-09-14T21:56:52Z")

</div>

Hi Joe,

I’m using the static library.

Please kindly do not remove static libraries, as it’s seriously much less hassle with them.  
You don’t need to support multiple versions of Visual Studio, just support one, that is compatible with latest version of Visual Studio, it’s important to stay up to date with technology.

Right now distributing both dll + static lib is the best option, so developers can choose what’s best for them.

Please please please do not remove the static lib

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [September 15, 2015, 7:09am UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/6 "2015-09-15T07:09:10Z")

</div>

Hi Greg,

Many of our users are stuck on older revisions of Visual Studio. We have to consider very carefully how much time is spent configuring and maintaining static libraries, particularly as the DLL can be used by everyone. We will take your feedback into consideration though.

---

<div class="post-metadata">

**Author:** ![esenthel](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/esenthel/32/18_2.png) [@esenthel](https://forums.imgtec.com/u/esenthel)\
**Post date:** [September 15, 2015, 7:41am UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/7 "2015-09-15T07:41:46Z")

</div>

Hi Joe,

I’m aware of that, my recommendation is tell them to upgrade.

It is better to support newer VS rather than older VS in my opinion.

Besides:  
VS 2015 Community is free  
latest versions of VS will usually generate the most optimized code  
Win10 is also free if that matters

I had the same dilemma recently, I was using VS 2008 for some things, up until few weeks ago, but I’ve finally decided to make the jump to 2015, and I don’t regret it.

---

<div class="post-metadata">

**Author:** ![JoeDavis](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/joedavis/32/71_2.png) [@JoeDavis](https://forums.imgtec.com/u/JoeDavis)\
**Post date:** [October 6, 2015, 9:01am UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/8 "2015-10-06T09:01:10Z")

</div>

Hi Greg,

Apologies for the delayed response. Unfortunately, it’s not as easy as recommending our users to upgrade to the latest version of Visual Studio. For many complex projects that are heavily tied into a particular version of the IDE, for example game engines that use many third party binaries that are compiled for a specific version of Visual Studio, upgrading isn’t viable. This leaves us with two options; only provide dynamic libraries that work for everyone, or allocate resources to maintaining many static libraries. We’ve chosen to discontinue the static libraries so we can allocate resources to more pertinent tasks.

---

<div class="post-metadata">

**Author:** ![esenthel](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/esenthel/32/18_2.png) [@esenthel](https://forums.imgtec.com/u/esenthel)\
**Post date:** [October 6, 2015, 7:46pm UTC](https://forums.imgtec.com/t/pvrtexlib-crashes-on-64-bit/2364/9 "2015-10-06T19:46:18Z")

</div>

Hi,

I’m a game engine developer myself, I’m the creator of [http://esenthel.com](http://esenthel.com) (Windows Mac Linux Android iOS Web game engine).

I’m using heaps of 3rd party libs:  
-AdMob  
-ISPC Texture Compressor  
-Bullet  
-Chartboost  
-Diff Match Patch  
-Facebook  
-FBX  
-Flac  
-FreeType  
-JpegTurbo  
-LZ4  
-LZHAM  
-LZMA  
-Mpg123  
-Oculus  
-Ogg  
-OpenAL  
-Opus  
-PhysX  
-Png  
-PVRTC  
-Recast  
-Snappy  
-SQLite  
-SteamWorks  
-Theora  
-Tiff  
-Vorbis  
-VPX  
-Webp  
-Zlib

And none of them are holding me back from using them with VS 2015. Only FBX, Steam and PhysX require DLL’s, while all others for Windows I can use as static LIB’s.

I was even able to make your PVRTexLib static lib work with VS 2015 using a trick.

I hope you reconsider providing static libs for VS 2015, thank you.
