在 Visual C 中使用 zlib CLR Windows 窗体应用程序
我已经尝试这样做很长时间了,那就是让 zlib 库与我的程序一起使用。我将 Microsoft Visual C++ 2008 Express Edition 与 CLR Windows 窗体应用程序一起使用。问题是我担心 zlib 太旧而无法与我正在使用的东西一起使用。我找到的 zlib 的所有示例(极少数示例)都是 Win32 应用程序。
那是另一回事;我找不到任何未过时的 zlib 示例。我确实知道 zlib 已经过时了,但我找不到任何替代品:(
所以如果有人能首先告诉我是否可以在我的应用程序中使用 zlib 以及如何使用,非常感谢。如果有人想采取更进一步,也许可以推荐一个更好的类似 zlib 的程序,我可以使用,更感谢
(顺便说一句,我正在创建一个应用程序来读取游戏《我的世界》的关卡数据。可以在 上找到一些信息。那个此处。)
I've been trying to do this for a long time, and that is to get the zlib library to work with my program. I'm using Microsoft Visual C++ 2008 Express Edition with a CLR Windows Forms Application. The thing is I'm worried that zlib is to old to work with what I'm using. All the examples (the very few examples) of zlib I find are with a Win32 application.
And that's the other thing; I can't find any zlib examples that aren't outdated. And I do understand that zlib is old, but I can't find any alternatives :(
So if anyone could first of all tell me if its possible to use zlib with my application, and how, thanks a bunch. If someone wants to take it a step further and maybe recommend a better zlib-like program that I can use, thanks even more.
(And by the way, I'm creating an application to read the level data of the game Minecraft. A little can be found on that here.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这不是问题,C++/CLI 就是为了处理这样的任务而设计的。您必须告诉编译器 zlib 头不是由 #pragma 管理的托管代码,并告诉链接器链接导入库。像这样,在示例控制台模式应用程序中:
您唯一需要做的就是将 DLL 复制到构建目录中,以便您可以调试代码。项目 + 属性、构建事件、构建后事件、命令行:
也许您想选择不同的安装目录:)
It is not a problem, C++/CLI was made to handle tasks like this. You have to tell the compiler that the zlib header isn't managed code with #pragma managed and tell the linker to link the import library. Like this, in a sample console mode app:
Only other thing you have to do is to get the DLL copied into the build directory so you can debug the code. Project + Properties, Build Events, Post-Build Event, Command line:
Maybe you want to pick a different install directory :)
我在多个 C++/CLI 应用程序中使用了 DotNetZip 库。它非常容易上手,而且我还没有发现任何它不能做的事情(压缩、解压缩、受密码保护的 zip 文件都运行良好)。从描述来看,它是对 ZLib 的改进:
I've used the DotNetZip library in several C++/CLI applications. It's very easy to get going and I've yet to find anything it can't do (zipping, unzipping, password protected zip files all works well). From the description, it's an improvement over ZLib:
如果您使用 CLR,您不能使用内置的 .NET gzip 库吗?
http://msdn.microsoft.com/en-us /library/system.io.compression.gzipstream.aspx
If you're using CLR, can't you use the built in .NET gzip library?
http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx