What's a good, threadsafe, way to pass error strings back from a C shared library

Posted by PerilousApricot on Stack Overflow See other posts from Stack Overflow or by PerilousApricot
Published on 2010-12-22T23:41:31Z Indexed on 2010/12/22 23:54 UTC
Read the original article Hit count: 187

Filed under:
|
|

Hello, all-

I'm writing a C shared library for internal use (I'll be dlopen()'ing it to a c++ application, if that matters). The shared library loads (amongst other things) some java code through a JNI module, which means all manners of nightmare error modes can come out of the JVM that I need to handle intelligently in the application. Additionally, this library needs to be re-entrant. Is there in idiom for passing error strings back in this case, or am I stuck mapping errors to integers and using printfs to debug things?

Thanks!

© Stack Overflow or respective owner

Related posts about c++

Related posts about c