#add fPIC to the MOREFLAGS in the Makefile, run make, then run these: gcc -shared -fPIC -L ../lib zstd_zlibwrapper.o gzclose.o gzlib.o gzread.o gzwrite.o -lz -lzstd -o zstd_preload.so export LD_LIBRARY_PATH=/home/cwilks/zstd-1.3.3/lib #in gdb set environment LD_PRELOAD /home/cwilks/zstd-1.3.3/zlibWrapper/zstd_preload.so set exec-wrapper env 'LD_PRELOAD=/home/cwilks/zstd-1.3.3/zlibWrapper/zstd_preload.so' #add redirection methods cat zstd_zlibwrapper.c | perl -ne 'chomp; $s=$_; if($s=~/ZEXTERN int ZEXPORT z_/) { $P=1; $s1=$s; $s1=~s/ZEXTERN int ZEXPORT z_/ZEXTERN int ZEXPORT /; print "$s1\n"; @f=split(/\s+/,$s); $s1=~/ZEXTERN int ZEXPORT ([^ ]+) /; $func=$1; $nl = "return z_$func("; for($i=5; $i5); $f[$i]=~s/\*//g; $f[$i]=~s/\)\)/\)/; $nl.=$f[$i]; } if($s=~/\)\s*$/) { print "{\n\t$nl;\n}\n"; $P=undef;} next;} if($P) { print "$s\n"; @f=split(/\s+/,$s); for($i=1; $i redirections.add #run this with normal bgzip (zlib) rsync -av /data/test15.fq.10000000 /data/test15.fq.10000000.1 time LD_PRELOAD=/home/cwilks/zstd-1.3.3/zlibWrapper/zstd_preload.so ./bgzip /data/test15.fq.10000000.1