473,472 Members | 2,184 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

C# and ZLib

Would someone mind helping me with a DllImport call to zlib 1.2.1?
I've tried several alternatives such as SharpZipLib, but they won't
work for what I'm doing. I have it sort of figured out, but it gives
errors sometimes such as "Object reference not set to an instance of
an object". I think it has something to do with zlib needing the
pointers to my variables, and I can't figure out how to give it the
pointer to a byte array. In the C++ header file for zlib the
uncompress function is listed as:

ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const
Bytef *source, uLong sourceLen));

This was working, but was causing errors when extracting some files
like I said above:

[DllImport("zlib1.dll")]
static extern int uncompress(byte[] destBuffer, uint destLen, byte[]
sourceBuffer, uint sourceLen);

Thanks!
Nov 16 '05 #1
2 8700
Bien <da****@etriculate.com> wrote:
Would someone mind helping me with a DllImport call to zlib 1.2.1?
I've tried several alternatives such as SharpZipLib, but they won't
work for what I'm doing. I have it sort of figured out, but it gives
errors sometimes such as "Object reference not set to an instance of
an object". I think it has something to do with zlib needing the
pointers to my variables, and I can't figure out how to give it the
pointer to a byte array. In the C++ header file for zlib the
uncompress function is listed as:

ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const
Bytef *source, uLong sourceLen));

This was working, but was causing errors when extracting some files
like I said above:

[DllImport("zlib1.dll")]
static extern int uncompress(byte[] destBuffer, uint destLen, byte[]
sourceBuffer, uint sourceLen);


The destlen looks to me like it should be ref uint rather than uint,
given that the declaration has a pointer. I'm not an interop expert
though - I suggest if that doesn't work, you try in the .interop group.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
www.vkarlsen.no - I think he has a zlib conversion already.
--
Pete
-------
http://www.HowToDoThings.com
Read or write articles on just about anything
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alan Toppen | last post by:
I was unable to use the ZipFile class in the zipfile module in Python2.4. I got an error that zlib could not be found. Comparing my Python 2.2 installation I noticed Python 2.4 was missing a...
0
by: Tony | last post by:
Hello, Any assistance would be appreciated: As the subject suggests I am trying to gunzip files using the Compress::Zlib module. The following is basically the code that I am working with: ...
6
by: Laszlo Zsolt Nagy | last post by:
Sorry, I realized that the import zlib was not executed from my (working) service. So here is the question: why can't I use zlib from a win32 service? Is there any way to make it working? ...
1
by: Andreas Lobinger | last post by:
Aloha, is a pure _python_ implementation of the zlib available? I have broken zlib streams and need to patch the deocder to get them back. Wishing a happy day LOBI
1
by: Dennis Powell | last post by:
Does anyone have a successful implementaion of the zlib.dll in VB. Net they can show me. I'm writting a class encaplsulating zlib functionality and I keep getting a System.NullReferenceException...
4
by: shamzz | last post by:
Hi, I've compiled (configure/make/make install) Python 2.4.4 from source on Suse Linux Enterprise Server 9 (x64). I need Python to be compiled with Zlib so that I can compile and use Zope. ...
3
by: stuntgoat | last post by:
import zlib works in Python 2.4 (debian etch AMD64 - default python version for that distro) I built python 2.5 from source; zlib is not importable. I am trying to compile MySQLdb. any...
1
by: mhearne808[insert-at-sign-here]gmail[insert-dot-he | last post by:
I can't seem to get the zlib module to build on an RHEL box. I did the following: 1) Download zlib 1.2.3 2) configure;make;make install 3) Download python 2.5.2 4) configure;make;make install...
4
by: MZ | last post by:
Hello! I`ve tried to instal zlib library to use zip functions to pack files into zip archive. I don`t know how I have to configure zlib to make it work. I have built up php.ini file and...
2
by: rajevar | last post by:
hi, i have seen various post related to this topic but i couldnt resolve my issue yet. Im using python version 2.5 on Linux environment this is the error im getting if i try to import zlib ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.