Hi Laurent, > # uLong compressBound (uLong sourceLen) > # int compress2(Bytef *dest, uLongf *destLen, const Bytef *source, > uLong sourceLen, int level)
I'm afraid I can give only a partial answer, as I don't understand the exact requirements of these functions well enough. However, here are some points: The lines '(dest `(genCharBuff bufSize) . 0) # *dest '(destLen (8 . N) . `bufSize) # *destLen are probably a problem. For one thing, using a read macro (with backquote) here doesn't do what you expect, because 'bufSize' is not bound yet when the function 'Zcompress2' is read. You can check that with (pp 'Zcompress2): ... (native "libz.so" ... '(dest (NIL B) . 0) '(destLen (8 . N)) ... Also, the size and type specifier must be reversed in the cons pairs. Correct would probably be (dest (<bufSize> B . <bufSize>)) # Return in 'dest', buffer size, return <bufSize> bytes and (destLen (8 . N) (<bufSize> . 8)) # Pass buffer size as long, return a long Then I would stay with some naming conventions, define 'Dest' and 'DestLen' as local variables, and get finally: (de Zcompress2 (InBuf Level) (let (InBufSize (size InBuf) BufSize (ZcompressBound InBufSize)) (use (Dest DestLen) (list (native "libz.so" # lib file "compress2" # function 'I # return value (error status) (list 'Dest # *dest (cons BufSize 'B BufSize) ) (list 'DestLen # *destLen (8 . N) (cons BufSize 8) ) InBuf # *source InBufSize # sourceLen Level ) # level (head DestLen Dest) ) ) ) ) Notes: - For system libraries, you don't need to pass the full path. Thus, instead of (native "/usr/lib/libz.so" ..) you can simply write (native "libz.so" ..) - I don't know what 'compress2' does with multibyte UTF-8 chars, but in any case it is better to use (size inBuf) instead of (length inBuf) Cheers, - Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe