a .dll works on 32-bit machine but not 64-bit machine

E

erxuan

Hi, I'm calling zlib.dll to compress/uncompress file in my C# program.
The problem is it works very well on my 32-bit machine, but on another
64-bit machine, it throw an exception says "An attempt was made to load
a program with an incorrect format. <Exception from HRESULT:
0x8007000B>"
when uncompress() is called.

Since I have the source code of Zlib, I can build and generate both
..lib and .dll files. The generated .lib file works well in my C++
program on the 64-bit machine. But the generated .dll just keep
throwing exceptions in my C# program on the same machine.

Did I miss something? I'm really appreciate your help!
 
B

Bela Istok

Compile your C# program to use 32 bits, you do this in, the IDE, click in
the arrow that says Any CPU->Configuration Manager: Active Solution
Platform-> <New...>

Regards,

Bela Istok
 
B

Bela Istok

Other Question why you use zlib, if the .net framework 2.0 includes a method
to use the gzip format?

See the namespace System.IO.Compression.

Regards,

Bela Istok
 
E

erxuan

Problem solved! Thank you!

I guess I have to use zlib in my case since I need to parse some files
as input which were compressed using zlib by others.
 
B

Bela Istok

As far as I know, zlib uses the Gzip standard, you can use any library that
handle that standard, give a try ;)

Regards,

Bela Istok
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top