[QScintilla] Why do header files force C++ linkage on Macs?

Phil Thompson phil at riverbankcomputing.com
Thu May 19 18:16:04 BST 2016


On 17 May 2016, at 2:16 pm, Marcus Calhoun-Lopez <mcalhoun at macports.org> wrote:
> 
> Greetings.
> 
> I am trying to resolve an issue installing GNU Octave with the MacPorts system.
> 
> Octave includes qscilexeroctave.h, which includes a whole bunch of other files until it gets to a header file from Gnulib.
> Gnulib attempts to add a security warning to the C functions gets.
> Because qscilexeroctave.h wraps everything in “extern "C++",” there is a conflict between the linkages of gets (C vs C++).
> 
> A few solutions have been proposed in the various discussions about this problem (see references below).
> On solution is to remove the “extern "C++"” from the Qt4Qt5/Qsci/*.h qscintilla header files:
> 
> -#ifdef __APPLE__                                                                                                                                                                                           
> -extern "C++" {                                                                                                                                                                                             
> -#endif
> ...
> -#ifdef __APPLE__                                                                                                                                                                                           
> -}                                                                                                                                                                                                         
> -#endif 
> 
> For me, qscintilla and Octave both build fine after the change.
> 
> Is this a safe change?
> Any insight into why forcing C++ linkage is necessary (but just on Macs) would be appreciated.

They were needed to work around a problem with the Qt binary installers circa 2007.

> Is this a change that can be considered upstream?

I'll add it to the TODO list.

Phil



More information about the QScintilla mailing list