gnustep-dev
[Top][All Lists]
Advanced

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

AppKit headers and language linkage issue


From: Quentin Mathé
Subject: AppKit headers and language linkage issue
Date: Mon, 14 Jan 2013 18:02:10 +0100

Hi,

The latest Clang (from LLVM trunk) complains about imported AppKit headers as 
shown below:

In file included from 
/home/qmathe/testbuilds/trunk/etoile-trunk/Build/EtoileXML/ETXMLXHTML-IMParser.h:35:
In file included from 
/home/qmathe/testbuilds/trunk/Local/Library/Headers/AppKit/AppKit.h:93:
/home/qmathe/testbuilds/trunk/Local/Library/Headers/AppKit/NSPasteboard.h:109:25:
 error: declaration of 'NSDataLinkPboardType' has a different language linkage
APPKIT_EXPORT NSString *NSDataLinkPboardType;
                       ^
/home/qmathe/testbuilds/trunk/Local/Library/Headers/AppKit/NSDataLink.h:151:25: 
note: previous definition is here
APPKIT_EXPORT NSString *NSDataLinkPboardType;
                       ^
1 error generated.

The is because 'APPKIT_EXPORT NSString *NSDataLinkPboardType' is wrapped inside 
#if defined(__cplusplus) for NSPasteboard.h, but not for NSDataLink.h.

From what I see we wrap very few headers in #if defined(__cplusplus):

Headers/AppKit/NSApplication.h:#if defined(__cplusplus)
Headers/AppKit/NSApplication.h:#if defined(__cplusplus)
Headers/AppKit/NSGraphics.h:#if defined(__cplusplus)
Headers/AppKit/NSGraphics.h:#if defined(__cplusplus)
Headers/AppKit/NSInterfaceStyle.h:#if defined(__cplusplus)
Headers/AppKit/NSInterfaceStyle.h:#if defined(__cplusplus)
Headers/AppKit/NSPanel.h:#if    defined(__cplusplus)
Headers/AppKit/NSPanel.h:#if    defined(__cplusplus)
Headers/AppKit/NSPasteboard.h:#if defined(__cplusplus)
Headers/AppKit/NSPasteboard.h:#if defined(__cplusplus)

So I'm not sure if we should remove these or just wrap every AppKit header in 
the same way? 
Apple doesn't seem to wrap code inside extern "C" { } in their Foundation or 
AppKit headers, but I have the impression they were using extern "C" { } in the 
past.

From what I understand, extern "C" { } is needed when compiling ObjC++ code and 
continue to expose C symbols as true C symbols (no C++ name mangling). But it 
seems to me we never compile the AppKit as ObjC++ code? Am I missing something?

Cheers,
Quentin.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]