For sure it is possible.
You have to read the documentation for the API you're trying to use. Learn how to detect and handle errors, change your code.
If there are crashes use a debugger to try to understand why.
Most of the times it is dereferencing null/invalid pointers.
p.s. This has nothing to do with C::B, it is just a generic programming problem.