[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: aspell upgrade woes

On Wed, Jul 20, 2005 at 02:51:14PM -0700, Steve Langasek wrote:

 > Yeah, this is another lib with a C++ implementation that only exports
 > a C ABI in its headers.  (other telltale signs to look for besides
 > '::', btw are 'use', 'class', 'operator'; but that may obviously give
 > false positives.) The C++ bits within the library are a whole lot of
 > template implementations, and a few internal classes that are only
 > exposed in the headers via C wrappers.  If you're sure that nothing
 > out there is using tsqllib internals inappropriately, then there's no
 > need for a package name change.

 Actually the proper way is to check the public headers and look if the
 interface is guarded with extern "C" { ... }.  There _must_ be a
 check like:

    #ifdef __cplusplus
    extern "C" {

    /* ... */

    #ifdef __cplusplus

 Just take the public header and pass it thru the preprocessor:

 $ g++ -E /usr/include/GL/gl.h | grep -v ^#

 look for the bits outside the extern "C" linkage:

typedef int ptrdiff_t;
typedef unsigned int size_t;

 that's harmless.  Let's say you do find something like:

extern void glEnableTraceMESA( GLbitfield mask );

 _outside_ the extern "C" block... that is _not_ harmless.

 A small parser that looks for extern "C", the "{" right after it and
 the matching "}" should make things much easier.


Reply to: