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

Mario Emmenlauer commented on THRIFT-5898:
------------------------------------------

The suggested change about GlobalOutput in 
https://github.com/apache/thrift/pull/3226/files looks good to me! But would it 
be possible to separate it from building shared libraries? I think this change 
is very useful in itself, because it leads to much cleaner code, and avoids 
compiler warnings on MSVC.

For building shared libraries on MSVC, I think the suggested PR is not 
sufficient, because the library would not export any symbols. It is still 
missing all the dllexport macros 
(https://learn.microsoft.com/en-us/cpp/build/exporting-from-a-dll-using-declspec-dllexport).

> Unable to build Thrift as a shared library on Windows
> -----------------------------------------------------
>
>                 Key: THRIFT-5898
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5898
>             Project: Thrift
>          Issue Type: Task
>          Components: C++ - Library
>    Affects Versions: 0.22.0
>         Environment: Windows C++ building shared library (DLL)
>            Reporter: Carel
>            Assignee: Carel
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> When trying to build the C++ library as a shared library on Windows the build 
> fails with the following compiler error:
> {code:java}
>      Creating library 
> C:/j/b/thrif937bd10a672f8/b/build/lib/Release/thriftnbmd.lib and object 
> C:/j/b/thrif937bd10a672f8/b/build/lib/Release/thriftnbmd.exp
> TNonblockingServer.obj : error LNK2019: unresolved external symbol "class 
> apache::thrift::TOutput apache::thrift::GlobalOutput" 
> (?GlobalOutput@thrift@apache@@3VTOutput@12@A) referenced in function "public: 
> virtual __cdecl apache::thrift::server::TN
> onblockingIOThread::~TNonblockingIOThread(void)" 
> (??1TNonblockingIOThread@server@thrift@apache@@UEAA@XZ) 
> [C:\j\b\thrif937bd10a672f8\b\build\lib\cpp\thriftnb.vcxproj]
> TNonblockingServerSocket.obj : error LNK2001: unresolved external symbol 
> "class apache::thrift::TOutput apache::thrift::GlobalOutput" 
> (?GlobalOutput@thrift@apache@@3VTOutput@12@A) 
> [C:\j\b\thrif937bd10a672f8\b\build\lib\cpp\thriftnb.vcxproj]
> C:\j\b\thrif937bd10a672f8\b\build\bin\Release\thriftnbmd.dll : fatal error 
> LNK1120: 1 unresolved externals 
> [C:\j\b\thrif937bd10a672f8\b\build\lib\cpp\thriftnb.vcxproj]
>   Building Custom Rule C:/j/b/thrif937bd10a672f8/b/src/lib/cpp/CMakeLists.txt
>  {code}
> This is caused by the recent change inĀ 
> [PR#3077|https://github.com/apache/thrift/pull/3077/files] that removed the 
> export of {{GlobalOutput}} as commented on the PR. 
> Possible solutions would be:
> # Put back exporting the symbols so that the libraries can be build.
> ## Probably the least amount of effort
> ## Still requires exporting a symbol which is not normally done in a library 
> # Remove the need for thrift libraries to use this symbol
> ## This takes away a feature providing visibility into runtime behaviour that 
> can potentially be useful in debugging. 
> ## Removes something from all users due to an issue on the Windows side
> # Replace the symbol with an alternative solution 
> ## More invasive compared to  #1 
> ## Does not remove anything
> ## Changes the interface and usage which will affect external users of this 
> interface



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to