The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15549 
====================================================================== 
Reported By:                Micha Renner
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15549
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2015-04-30 08:01 EDT
Last Modified:              2015-04-30 08:01 EDT
====================================================================== 
Summary:                    The extern keyword
Description: 
It seems that the "extern" keyword is much more important than previously
thought, at least for the MSVC in connection with static libraries.

The example in the appendix demonstrates this. 




Steps to Reproduce: 
- build this project
- run the program => wrong output

- open the tlib_export.h file in the CMAKE_BINARY_DIR:
        - change:
          #ifdef TLIB_STATIC_DEFINE
          #  define TLIB_EXPORT
          to
          #ifdef TLIB_STATIC_DEFINE
          #  define TLIB_EXPORT extern
- build the project again
- run the program => correct results.



Additional Information: 
May be one can change the GENERATE_EXPORT_HEADER macro to add the extern keyword
automaticlly .

(example is taken from the ffi library)
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2015-04-30 08:01 Micha Renner   New Issue                                    
2015-04-30 08:01 Micha Renner   File Added: example.zip                      
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to