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

Marcus Calhoun-Lopez mcalhoun at macports.org
Tue May 17 14:16:20 BST 2016


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.

Is this a change that can be considered upstream?

Thank you,
Marcus

Bug References:
https://trac.macports.org/ticket/51399 <https://trac.macports.org/ticket/51399>http://octave.1599824.n4.nabble.com/build-failure-on-OSX-10-9-td4659114.html <http://octave.1599824.n4.nabble.com/build-failure-on-OSX-10-9-td4659114.html>
http://savannah.gnu.org/bugs/?43243 <http://savannah.gnu.org/bugs/?43243>
​http://octave.1599824.n4.nabble.com/Building-3-8-0-on-Mountain-Lion-10-8-5-td4660795.html <http://octave.1599824.n4.nabble.com/Building-3-8-0-on-Mountain-Lion-10-8-5-td4660795.html>

Software References:
https://www.gnu.org/software/octave/ <https://www.gnu.org/software/octave/>
https://www.macports.org <https://www.macports.org/>
https://www.gnu.org/software/gnulib/ <https://www.gnu.org/software/gnulib/>




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/qscintilla/attachments/20160517/48bb8b4b/attachment.html>


More information about the QScintilla mailing list