lh3 / bwa

Burrow-Wheeler Aligner for short-read alignment (see minimap2 for long-read alignment)
GNU General Public License v3.0
1.54k stars 557 forks source link

Avoid conflicting with HTSlib's kstring.c functions #346

Open jmarshall opened 2 years ago

jmarshall commented 2 years ago

Some people's programs use both HTSlib and libbwa.a — see e.g. samtools/htslib#693. Unfortunately one function — ksprintf — is defined in both libraries, leading to linker errors.

This happens for ksprintf only, because all the other functions in bwa's kstring.h are declared as static inline.

This PR makes ksprintf() static inline in kstring.h, so that it (like the other bwa/kstring.h functions) won't conflict with similar HTSlib functions. Instead implement it and a new kvsprintf() in terms of a new bwa_kvsprintf() function. Fixes samtools/htslib#693.