#add fPIC to the MOREFLAGS in the Makefile, run make, then run these: export LD_LIBRARY_PATH=..//lib gcc -shared -fPIC -L ../lib zstd_zlibwrapper.o gzclose.o gzlib.o gzread.o gzwrite.o -lz -lzstd -o zstd_preload.so nm -D zstd_preload.so #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 time cat /data2/test15.fq.bgzs | LD_PRELOAD=/home/cwilks/zstd/lib/zstd_preload.so bgzip -d cat /data/h1_intervals.tsv | LD_PRELOAD=/home/cwilks/zstd/lib/zstd_preload.so bgzip > /data2/h1_intervals.tsv.bgzs #doesn't work due to missing magic number? LD_PRELOAD=/home/cwilks/zstd/lib/zstd_preload.so tabix -s2 -b3 -e4 /data2/h1_intervals.tsv.bgzs for gdb debugging, after startup: set environment LD_PRELOAD /home/cwilks/zstd/lib/zstd_preload.so gdb --args env LD_PRELOAD=/home/cwilks/zstd/lib/zstd_preload.so tabix -s2 -b3 -e4 /data2/h1_intervals.tsv.bgzs LD_PRELOAD=/home/cwilks/zstd/lib/zstd_preload.so tabix /data2/h1_intervals.tsv.bgzs chr1:11845-12009