[ 
https://issues.apache.org/jira/browse/XERCESC-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16393736#comment-16393736
 ] 

Roger Leigh commented on XERCESC-2119:
--------------------------------------

Please see the attached patch.  Also here: 
[https://github.com/rleigh-codelibre/xerces-c/commits/template-export-fix] and 
tested 
[https://travis-ci.org/rleigh-codelibre/xerces-c/builds/351429977?utm_source=github_status&utm_medium=notification]
 and [https://ci.appveyor.com/project/rleigh-codelibre/xerces-c/build/1.0.162] 
as well as on MacPorts with GCC 4.2.

 

This moves the explicit template instantiation into a dedicated translation 
unit.  It's not named Janitor.cpp because automake can't cope with Janitor.c as 
well (it tries to compile Janitor.c instead...).  So I had to call it 
JanitorExports.cpp as a workaround for this bug.  It also updates the header to 
declare the exports in Janitor.hpp, so all users of the templates see the 
explicit instantiation.  This seems to work properly on all systems, but review 
by someone familiar with Windows DLLs and template exporting would be 
appreciated.

> warning C4251: 'xercesc_3_2::TranscodeToStr::fString': class 
> 'xercesc_3_2::ArrayJanitor<XMLByte>' needs to have dll-interface to be used 
> by clients of class 'xercesc_3_2::TranscodeToStr'
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-2119
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2119
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 3.2.0
>         Environment: windows
>            Reporter: Mathieu Champlon
>            Assignee: Roger Leigh
>            Priority: Major
>             Fix For: 3.2.1
>
>         Attachments: 0001-Explicitly-export-ArrayJanitor-templates.patch, 
> dll_interface.patch
>
>
> Upgrading from xerces 3.1.2 to 3.2.0 on windows introduces a few of
> {noformat}
> (...)\include\xercesc/util/TransService.hpp(559): error C2220: warning 
> treated as error - no 'object' file generated
> (...)\include\xercesc/util/TransService.hpp(559): warning C4251: 
> 'xercesc_3_2::TranscodeToStr::fString': class 
> 'xercesc_3_2::ArrayJanitor<XMLByte>' needs to have dll-interface to be used 
> by clients of class 'xercesc_3_2::TranscodeToStr'
> (...)\include\xercesc/util/TransService.hpp(559): note: see declaration of 
> 'xercesc_3_2::ArrayJanitor<XMLByte>'
> (...)\include\xercesc/util/TransService.hpp(641): warning C4251: 
> 'xercesc_3_2::TranscodeFromStr::fString': class 
> 'xercesc_3_2::ArrayJanitor<XMLCh>' needs to have dll-interface to be used by 
> clients of class 'xercesc_3_2::TranscodeFromStr'
> (...)\include\xercesc/util/TransService.hpp(641): note: see declaration of 
> 'xercesc_3_2::ArrayJanitor<XMLCh>'
> {noformat}
> As pragma deactivating C4251 is frown upon on the project I work, I ended up 
> exporting the types, see attached patch.
> Note that this was also mentioned in XERCESC-1974.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to