zlib for WinRT?
Asked Answered
K

3

1

I require zlib library for the development of Windows Store app.

Has anyone converted Win32 zlib project to WinRT yet?

Can anyone please describe the steps to convert the existing win32 static lib project to winRT?

Keeler answered 16/12, 2012 at 11:17 Comment(0)
O
2

Visual C++ is already a supported language for WinRT development, if you wan't to use zlib, just compile it together with your solution. There is nothing that is preventing you from reusing standard ISO C and C++ libraries from within the WinRT, if you are using the C++ language, you might have to expose certain aspects of your library as WinRT Components but only if you need to interface with facilities like XAML or other WinRT languages but that should be a walk in the park. Not something which is tremendously difficult to do.

The whole point of supporting C++ in the WinRT is to allow an existing ecosystem of largely native applications to be ported to the Windows Store. zlib is not an exception. Non-standard ISO C and C++ such as sockets are not supported but there you have alternatives that you can plug-in to, just check that the library you're using has some kind of portability support.

Obstinate answered 16/12, 2012 at 14:48 Comment(4)
+1, THANK YOU! I spent hours playing with zlib library and I'm able to convert zlib (zlibstat) project to Windows Store library project (x86, x64 and ARM (with couple of workarounds)). zlib is using assembly code which worked well with x86 and x64 but in case of ARM, I had to bypass assembly and tweaked some compiler directives to make it work. Then created a Windows Store C++ blank app (xaml) project, used three lib files (x86_zlibstat.lib, x64_zlibstat.lib, ARM_zlibstat.lib) and verified the package with Store > Create App Package.. it worked! Haven't tested the functionality though.Keeler
This is first Windows Store library project, which I converted from existing code. But there is always a chance of improvement. For one, the assembler code (in contrib\masmx86 and contrib\masmx64 folders) has longest_match()` and inflate_fast() functions for x86 and x64. For ARM, I used the C version of longest_match and instead using inflate_fast(), used inflate(). Would be nice, if we have equivalnet ARM assembler code for inffasx64.asm and gvmat64.asm.Keeler
@Keeler I know this is an old post. But I am currently porting a library to C++/CX which depends on the zlib. I have no idea how to suit the zlib to Windows Store app. Could you give me some directions?Benia
@Benia you need to compile zlib as a static library then add that library as a dependency, library input. Check for tutorials for using static libraries with C++/CX and you should be good.Obstinate
C
1

WinRT is very limited with regards to C library functions which are present. What this means is that virtually all cross-platform C libraries are (AFAIK, I'm not a WinRT dev) unusable for that target.

For the case of zlib, there is an alternative: see this question

EDIT: to clarify what I'm saying above, I dug up a list of all CRT functions that are absent for WinRT, which you can find here. As long as zlib or any other C library does not depend on these function calls, you should be able to use the WinRT tools to build that C library. I even found a project file for zlib on winrt by the Ogre team here, not sure how useful it is to you.

Caporal answered 16/12, 2012 at 12:44 Comment(1)
Are you really sure about that? I can't find any documentation to support either or, I'm right now basing my answer on that the existing VC++ runtime is available for use which should be more than enough.Obstinate
C
0

You could take a look into this WinRT (Un)Zip component. Its used in production code already.

See the unit tests inside on how to use the component. It compiles on all WinRT architectures including ARM. It has no custom asm for ARM though.

Chelonian answered 12/3, 2013 at 10:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.