DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Tue, 2018-09-25, 02:29

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Tue, 2018-04-10, 04:09 
Offline

Joined: Thu, 2018-02-15, 16:59
Posts: 8
This is the first Visual Studio release that officially supports C++11 (and later standards, too), and that defines the "__cplusplus" macro accordingly. Previous versions set this macro to an archaic version number, even if they provided more or less complete C++11 support, and the /std=c++11 option was used.

So, finally, DCMTK can be compiled with C++11 and STL support on Windows, without any hack (e.g. disabling the compiler checks by a patch).

The only things you need:
- configure DCMTK with -DDCMTK_CXX11_FLAGS:STRING=/Zc:__cplusplus
- add /Zc:__cplusplus to the CMAKE_CXX_FLAGS variable of your project

It would be nice if DCMTK could do the first automatically, or if it would not overwrite the flags with VS and C++11.

I wanted to provide a patch, but I'm not sure if this preview release can be distinguished from the previous previews reliably.

Maybe someone knows, how. Or anyway, maybe my findings will be useful for someone.


Top
 Profile  
 
PostPosted: Tue, 2018-04-10, 13:29 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Mon, 2014-03-03, 09:51
Posts: 258
Location: Oldenburg, Germany
What version of DCMTK are you using? We have some "per-feature" tests since DCMTK 3.6.2. I would be suprised if Visual Studio now implements std::error_code correctly, but this is also handled independently from the C++11 flag since version 3.6.2.


Top
 Profile  
 
PostPosted: Tue, 2018-04-10, 14:25 
Offline

Joined: Thu, 2018-02-15, 16:59
Posts: 8
3.6.3

It builds fine, although I did not run its tests. Compiler checks are done at configuration and build time, those do pass.


Top
 Profile  
 
PostPosted: Tue, 2018-04-10, 18:54 
Offline

Joined: Thu, 2018-02-15, 16:59
Posts: 8
I ran the tests.

In release mode all the tests pass.

On debug mode one test crashes because of an assertion failure inside the STL implementation of VS:

This test:

ofstd_OFVector

Screenshot of the error:

https://ibb.co/ijMWBc

At this line:
https://github.com/DCMTK/dcmtk/blob/DCM ... vec.cc#L51

It looks like a bug in the VS library.


Top
 Profile  
 
PostPosted: Tue, 2018-04-10, 23:02 
Offline

Joined: Thu, 2018-02-15, 16:59
Posts: 8
In debug mode this option has to be added to the C++ flags:

Code:
/D_ITERATOR_DEBUG_LEVEL=1


The default value is 2 for debug builds, causing a crash.

Unfortunately, this cannot be added to CMAKE_CXX_FLAGS_DEBUG, because it gets overwritten when building static libs, but it can be added to DCMTK_CXX11_FLAGS. One must be careful not to set this for release builds, though.


Top
 Profile  
 
PostPosted: Wed, 2018-04-11, 09:14 
Offline
OFFIS DICOM Team
OFFIS DICOM Team

Joined: Mon, 2014-03-03, 09:51
Posts: 258
Location: Oldenburg, Germany
Interesting. It seems they really made progress. I have just added a feature to our issue tracker: https://support.dcmtk.org/redmine/issues/824


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group