Dude there is a bch library in linux / lib ( http://lxr.free-electrons.com/source/lib/bch.c )
The source code is in the above URL. I am not sure how to use the api library in a user program.
I assume that you need to compile and link the bch code to some common object, and then write your user source C.
when compiling a link to the aforementioned compiled shared object.
gcc -c yourfile.c -l bch.so -o yourfile
source share