I am using RB-zlib (zlib binding) from Boredom Software.
I am using the built in zlib in Mac OS X 10.10.5
When I build a 32 bit application and execute it, I get a “Incompatible Version” error
Any pointers ?
The error occurs in the following routine
Sub Constructor(CompressionLevel As Integer = zlib.Z_DEFAULT_COMPRESSION, CompressionStrategy As Integer = zlib.Z_DEFAULT_STRATEGY, Encoding As Integer = zlib.DEFLATE_ENCODING, MemoryLevel As Integer = zlib.DEFAULT_MEM_LVL)
’ Construct a new Deflater instance using the specified compression options.
’ If the deflate engine could not be initialized an exception will be raised.
// Calling the overridden superclass constructor.
// Constructor() – From zlib.FlateEngine
If CompressionStrategy <> Z_DEFAULT_STRATEGY Or Encoding <> DEFLATE_ENCODING Or MemoryLevel <> DEFAULT_MEM_LVL Then
’ Open the compressed stream using custom options
mLastError = deflateInit2_(zstruct, CompressionLevel, Z_DEFLATED, Encoding, MemoryLevel, CompressionStrategy, zlib.Version, zstruct.Size)
’ process zlib-wrapped deflate data
mLastError = deflateInit_(zstruct, CompressionLevel, zlib.Version, zstruct.Size)
If mLastError <> Z_OK Then Raise New zlibException(mLastError)
mLevel = CompressionLevel
mStrategy = CompressionStrategy
64 bit builds are not yet supported. The error coming from zlib is the result of a size mismatch for a shared data structure. The zlibx64 branch fixes the mismatch and a few other showstoppers but still in an experimental stage.
I did a short test on your zlibx64. I use your library with the latest Xojo under macOS 10.14.1, 64-Bit and got the following error message: “The zlib library is a different version than what was expected.”
It’s expecting zlib version 1.2.8. What version do you have? Some Googling suggests that OS X ships version 1.2.3.
I didn’t use an external zlib version. So could be that you are right that the built-in macOS version is 1.2.3
MBS Xojo Compression Plugin has Zip classes: ZLibCompressMBS and ZLibDecompressMBS.
Compiled for all targets and easy to use.
Is there any way of installing zlib version 1.2.8 in Mac OSX 10.10.5 ?
Does the MBS Xojo Compression Plugin package have examples of how to inflate and deflate pdf streams ?
yes you can install the latest zlib with Homebrew (https://brew.sh). However, to my knowledge, be aware that it will not be installed in /usr/local/lib because it may cause bad interferences with the System zlib. Instead, it would be installed somewhere in /usr/local/Cellar and you will have to explicitly indicate the full path in your Xojo project.
example of zlib usage with realstudio (old)
still opens and compiles fine under xojo 2018r3
I need to do Flate encoding and decoding.
The example at https://github.com/declaresub/zlib_rb does not seem to do that.
Or am I missing something here ?
Well, for PDF, we just let DynaPDF do that in our plugin.
The global function here should simply do that:
CompressZLibMBS(buf as string, level as integer) as string
CompressZLibMBS(buf as string, level as integer, byref error as integer) as string
DecompressZLibMBS(buf as string, size as integer) as string
DecompressZLibMBS(buf as string, size as integer, byref error as integer) as string
I tried CompressZLibMBS and DecompressZLibMBS functions and it worked fine in both Mac and Win.
How does one determine the size parameter in the decompress function ?
It probably is n times the input string. Any thumb rule for determining ‘n’ ?
Well, this assumes you know the size from compress.
Or just guess it.
I thought about doing a version which doesn’t need the output size.
I know the length of the compressed string. I thought a factor of 2 or 3 should be sufficient.
Is my assumption right ?
I think a version which does not require the output size makes more sense.
Is it possible to get it in the near future ?
Let me just check if I can add it today.
You can email me for a download Link later.
Could you finish the changes ?
Can I download it directly from your website ?
I wrote: You can email me for a download Link later.