Different compilers have different defaults (what are the clang defaults?) so in my particular case if I'm writing code which must also build and run via MSVC then having visibility hidden as the default is the only sensible thing to do. In general I would also use 'hidden' when developing any library API so ensure that there are no surprises later. I would suggest always using the hidden attribute unless you specifically disable it with a flag for your testing purposes. One good thing about hidden visibility is that you can grep the code to see everything which might be relevant to your API. :)
- Cirilo On Wed, Sep 7, 2016 at 3:33 AM, Tomasz Wlostowski <[email protected] > wrote: > Hi, > > I'm trying to build the kiface DLLs with all symbols exported so that I > could link them to external test programs (e.g. P&S test cases). > > AFAIK symbol visibility is normally controlled in CMake by through the > CMAKE_CXX_VISIBILITY_PRESET variable. However, the following code in the > CMakeLists.txt file forces the symbol visibility to hidden: > > -- snip -- > > if( POLICY CMP0063 ) > cmake_policy( GET CMP0063 VISIBILITY_POLICY ) > if( VISIBILITY_POLICY STREQUAL NEW ) > message( WARNING "Compatibility code for CMake < 3.3 can be > removed, search for CMP0063" ) > else() > cmake_policy( SET CMP0063 NEW ) > endif() > else() > if( CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY AND NOT APPLE ) > set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} > ${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY}hidden" ) > endif() > if( CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN AND NOT APPLE > ) > set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} > ${CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN}" ) > endif() > endif() > > -- snip -- > > Could anybody explain what is this code for and if it's really needed > (or maybe it's buggy)? > > As a side comment, is there any practical reason to link with > -fvisibility=hidden (maybe except the stable releases)? > > Cheers, > Tom > > > _______________________________________________ > Mailing list: https://launchpad.net/~kicad-developers > Post to : [email protected] > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp >
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

