MantisBT - Open CASCADE
View Issue Details
0029590Open CASCADE[OCCT] OCCT:Codingpublic2018-03-19 10:062018-06-29 21:19
abv 
bugmaster 
normalminor 
closedfixed 
[OCCT] 7.2.0 
[OCCT] 7.3.0[OCCT] 7.3.0 
Not needed
0029590: Coding - avoid usage of Standard_EXPORT attribute for inline methods
There are some places (around 300) where Standard_EXPORT attribute is attached to inline methods of the classes. On Windows this leads to instantiation of these methods as exported within all DLLs whose code includes corresponding header.
1. Generate C++ file including all headers of OCCT (except ones dependent on VTK -- these use export for whole classes...):

cd %CASROOT%/inc
echo "#include <windows.h>" >..\all_includes.cpp
ls -1 *.hxx | grep -i -v "ivtk" | gawk '{print "#include <" $0 ">"}' >>..\all_includes.cpp

2. Build DLL with the only source being that file, and option /FORCE to ensure creation of DLL even if some symbols remain unresolved (this allows to avoid linking with OCCT libs)

3. List all exports of this DLL (excluding constructor and destructor closure symbols generated automatically for unclear reason):

rem Set path to dumpbin.exe if not yet set, on example of VS 2015
set "PATH=%PATH%;%VS140COMNTOOLS%\..\..\VC\BIN"

dumpbin /exports all_includes.dll > all_exports.txt
undname all_exports.txt | grep -v "structor closure" > all_exports_undecorated.txt

The list should be empty
No tags attached.
txt all_exports_undecorated.txt (121,899) 2018-03-19 10:11
https://tracker.dev.opencascade.org/
Issue History
2018-03-19 10:06abvNew Issue
2018-03-19 10:06abvAssigned To => kgv
2018-03-19 10:11abvFile Added: all_exports_undecorated.txt
2018-03-19 10:13abvNote Added: 0074621
2018-03-19 10:14abvNote Added: 0074622
2018-03-19 18:16abvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=18754#r18754
2018-03-19 18:32abvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=18755#r18755
2018-03-19 18:34abvNote Added: 0074667
2018-03-19 18:55abvRelationship addedrelated to 0022651
2018-03-19 19:40gitNote Added: 0074677
2018-03-19 19:45abvNote Added: 0074678
2018-03-19 19:45abvStatusnew => resolved
2018-03-19 19:45abvTarget Version7.4.0* => 7.3.0
2018-03-19 19:49kgvAssigned Tokgv => bugmaster
2018-03-19 19:49kgvStatusresolved => reviewed
2018-03-19 19:49kgvProduct Version => 7.2.0
2018-03-19 19:49kgvNote Added: 0074679
2018-03-19 22:06abvNote Added: 0074685
2018-03-20 12:16bugmasterNote Added: 0074695
2018-03-20 12:16bugmasterStatusreviewed => tested
2018-03-20 12:16bugmasterTest case number => Not needed
2018-03-24 11:51bugmasterChangeset attached => occt master 0f57ab75
2018-03-24 11:51bugmasterStatustested => verified
2018-03-24 11:51bugmasterResolutionopen => fixed
2018-03-24 20:01gitNote Added: 0074875
2018-06-29 21:14aivFixed in Version => 7.3.0
2018-06-29 21:19aivStatusverified => closed

Notes
(0074621)
abv   
2018-03-19 10:13   
Attached file all_exports_undecorated.txt contains list of all exports generated on current master (with fixes for #22651 and 0029589) using the procedure described above (except that headers of old persistence are removed -- they cause some additional problems on linking).
(0074622)
abv   
2018-03-19 10:14   
The size of the DLL produced by the above procedure is 136 KB; on a version with about 1/3 of exports eliminated that size is 100 KB.
(0074667)
abv   
2018-03-19 18:34   
When exports of all inline methods are eliminated, empty DLL gets reduced to 32 KB in size; it still defines 128 symbols of the kind '...structor closure' generated automatically. I have no idea now why they are generated and how to avoid this.
(0074677)
git   
2018-03-19 19:40   
Branch CR29590 has been created by abv.

SHA-1: 44f526cf60db84a0b517d284071682ac9a871774


Detailed log of new commits:

Author: abv
Date: Mon Mar 19 10:07:06 2018 +0300

    0029590: Coding - avoid usage of Standard_EXPORT attribute for inline methods
    
    All occurrences of Standard_EXPORT attached to inline methods in OCCT code are eliminated.
    Some unused classes and C++ files producing no code are deleted.
(0074678)
abv   
2018-03-19 19:45   
Fix is pushed to CR29590, please review.

Note that the effect of this change on the DLLs size is minimal; binaries produced on this branch (based on CR22651) are 61.4 KB vs 61.7 KB on master.
(0074679)
kgv   
2018-03-19 19:49   
Patch looks OK.
(0074685)
abv   
2018-03-19 22:06   
For tests, see Jenkins job CR29590-master-abv
(0074695)
bugmaster   
2018-03-20 12:16   
Combination -
OCCT branch : CR29590 SHA - 44f526cf60db84a0b517d284071682ac9a871774
Products branch : master SHA - 2f8f449f24696d59603ade3d9a086e77e8b9a304
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian70-64:
OCCT
Total CPU difference: 18142.109999999855 / 18107.97999999989 [+0.19%]
Products
Total CPU difference: 7445.849999999999 / 7427.109999999995 [+0.25%]
Windows-64-VC10:
OCCT
Total CPU difference: 18003.451405998494 / 17842.61437499857 [+0.90%]
Products
Total CPU difference: 8132.129328699942 / 8148.135031299978 [-0.20%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0074875)
git   
2018-03-24 20:01   
Branch CR29590 has been deleted by kgv.

SHA-1: 44f526cf60db84a0b517d284071682ac9a871774