The difficulty with creating a C ++ library distributed in binary form is that your clients, users of the library, are usually forced to use the same C ++ compiler when creating the library. This can be problematic if you want to keep abreast of events, but they don’t, or if they want to keep abreast of events, but you don’t. If you are dealing with a source, this is less of a problem if your C ++ is portable enough to allow it to be used by all the compilers that your clients use.
If the code can be used with C, I would probably write code for the C interface. Alternative, provide two interfaces - a native C ++ interface and a C interface. But it is more than just a C interface. On the other hand, there may be advantages of a C ++ interface (possibly using STL iterators, etc.), and this may affect your decision.
Jonathan Leffler Jun 22 '09 at 1:13 2009-06-22 01:13
source share