[cmake-developers] [CMake 0015549]: The extern keyword

Mantis Bug Tracker mantis at public.kitware.com
Thu Apr 30 08:01:56 EDT 2015


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                      
======================================================================



More information about the cmake-developers mailing list