>>lcOutput = "this string is to be compressed" >>llen = LEN(lcOutput) >>lcBuff = SPACE(LEN(lcOutput)*1.2) >>lnFinalSize = LEN( lcBuff ) >>DECLARE integer Compress IN d:\webserv\zlib.dll as zlibCompress ; >> string @ dest, integer @ destlen, string src, integer srcLen >>Res = zlibCompress( @lcBuff, @lnFinalSize, lcOutput, lLen ) >>>>The last line fails, with the error message found in the subject. While googling a bit for the error, i saw suggestions to register the dll. I try to register, and i get the following message: "zlib.dll was loaded, but the DLLRegisterServer entry point was not found. The file cannot be registered. I don't know where did i get that version of zlib, maybe trying a newer version?
>&& lower case >DECLARE integer compress IN d:\webserv\zlib.dll as zlibCompress ; > string @ dest, integer @ destlen, string src, integer srcLen > >>
>#define TRUE .T. >#define FALSE .F. > > >#define Z_NO_FLUSH 0 >#define Z_PARTIAL_FLUSH 1 >* /* will be removed, use Z_SYNC_FLUSH instead */ >#define Z_SYNC_FLUSH 2 >#define Z_FULL_FLUSH 3 >#define Z_FINISH 4 >*/* Allowed flush values ; see deflate() below for details */ > >#define Z_OK 0 >#define Z_STREAM_END 1 >#define Z_NEED_DICT 2 >#define Z_ERRNO (-1) >#define Z_STREAM_ERROR (-2) >#define Z_DATA_ERROR (-3) >#define Z_MEM_ERROR (-4) >#define Z_BUF_ERROR (-5) >#define Z_VERSION_ERROR (-6) >*/* Return codes for the compression/decompression functions. Negative > * values are errors, positive values are used for special but normal events. > */ > >*/* compression levels */ >#define Z_NO_COMPRESSION 0 >#define Z_BEST_SPEED 1 >#define Z_BEST_COMPRESSION 9 >#define Z_DEFAULT_COMPRESSION (-1) > > >*/* compression strategy ; see deflateInit2() below for details */ >#define Z_FILTERED 1 >#define Z_HUFFMAN_ONLY 2 >#define Z_DEFAULT_STRATEGY 0 > >*/* Possible values of the data_type field */ >#define Z_BINARY 0 >#define Z_ASCII 1 >#define Z_UNKNOWN 2 > > >*/* The deflate compression method (the only one supported in this version) */ >#define Z_DEFLATED 8 > >* /* for initializing zalloc, zfree, opaque */ >#define Z_NULL 0 > >*/* for compatibility with versions less than 1.0.2 */ >#define zlib_version zlibVersion() > > >declare integer compress2 in d:\webserv\zlib.dll as zlibCompress ; > string @Dest, integer @DestLen, ; > string @Source, integer SourceLen, integer CompressionLevel > > > local EncodedLen, sts, stsmsg > > > EncodedLen = ceiling(len(m.UnEncoded) * 1.01 + 12) > Encoded = repl(chr(0), m.EncodedLen) > > sts = compress2(@m.Encoded, @m.EncodedLen, @m.UnEncoded, len(m.UnEncoded), Z_BEST_COMPRESSION) > > do case > case m.sts >= 0 > Encoded = left(m.Encoded, m.EncodedLen) > return empty(m.sts) > > otherwise > Encoded = '' > assert FALSE > return FALSE > endcase >