On Wed, 17 Dec 2008 17:10:59 you wrote: > It is true that with this approach only one C callback function can be > registered at one time. Via inheritance, several different types of > objects can simultaneously use lcms. If lcms was written in C++ then > it could provide a base class for callback objects (avoiding a global > registration entirely) but since it is written in C, a function with > C-language binding needs to then invoke a C++ class method (or > dispatch to Python, Perl, etc).
Hmmm, if it were object oriented (e. g. C++) no callback would be necessary anyways, as then just an exception could be thrown, that is managed through the default exception handling mechanism. But if it were C++ code, it wouldn't be as easy to wrap it to Python using ctypes ... (at least until ctypes handles that fully). > The other solution is to not use a callback at all and rely entirely > on data stuffed into a user supplied error report buffer. This makes > it difficult to do things like aborting further processing unless the > desired behaviors can be fully parameterized. There is the option of > a mixed solution where both a buffer and a callback function are > passed for each call to lcms, and the callback function is provided > with a pointer to the buffer. That's one of the problems with *any* callbacks. They don't "bite" at the place of the code invocation, but rather within the callback function/method. By a buffer, do you mean an error buffer passed by reference as an additional parameter to the library calls? Yet another approach I could envison is to wrap every call to lcms into a calling function, that acquires a lock, executes the lcms API call, inspects for an error, and returns with an appropriate state after releasing the lock. This way concurrency of the calls could be eliminated, while the rest of the code can happily run in parallel. It's also a bit of a dirty trick, but it might work. Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Pūtaiao o Mōhiohio me Pāngarau Room 2.63, Quad Block A Building Massey University, Auckland, Albany Private Bag 102 904, North Shore Mail Centre voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 eMail: g.kl...@massey.ac.nz http://iims.massey.ac.nz ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user