• entries
455
639
• views
424510

# GTL : zlib, PhysFS & GTL sitting in a tree..

148 views

.. getting along just fine [grin]

After a bit of jiggery pokery GTL and PhysFS now get along just fine.

As I mentioned in the other entry, I've had to do some adjustment to how the libraries are compiled, namely by removing zlib's files from both PhysFS and GTL and instead linking the zlib library in the final application.

It wasnt without its minor issues however, for example PhysFS defines Z_PREFIX, which pre-fixes all the functions with "z_". So, even when I linked in the zlib library it couldnt find them as my zlib build didnt define the same prefix so the function names didnt match...

The other issue was that 'lib static' for zlib still compiles to the DLL runtime and not the static runtime... silly.

Its just occured to me that infact that "z_" prefix is probably why I couldnt just link GTL to it successfull. So, I quickly remove the lib linking in the test application, recompiled PhysFS with the zlib files in it, relinked the test application and it all worked perfectly... panic over and score one for a lack of infomation in the PhysFS documentation...

Anyways, the practical upshot of all this is that the GTL can now be linked in with a program which supports PhysFS and allows you to load textures like so;

// Assumes you have added the correct paths earlier in your appPHYSFS_File* myfile = PHYSFS_openRead("test.bmp");GTL::Image tex = GTL::LoadTexture(myfile, GTL::TYPE_BMP);

As you might have noticed that this version requires you tell the GTL which file type the image is.
For conviniance you could also do it as such;
// Assumes you have added the correct paths earlier in your appPHYSFS_File* myfile = PHYSFS_openRead("test.bmp");GTL::Image tex = GTL::LoadTexture(myfile, "test.bmp");

and let GTL work out the file type based on the extension.
(the library takes all file names by const& so there is no copy overhead)

So, for the rest of today I'll work on a DLL version of the library and finally get a release out for the public to pull to bits [smile]

## 1 Comment

Hurry up, I wanna test it out :)

## Create an account

Register a new account