You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Dragan Okiljevic (JIRA)" <ji...@apache.org> on 2011/04/19 10:38:05 UTC

[jira] [Issue Comment Edited] (THRIFT-1123) Patch to compile Thrift server and client for vc++ 9.0 and 10.0

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

Dragan Okiljevic edited comment on THRIFT-1123 at 4/19/11 8:36 AM:
-------------------------------------------------------------------

To use this patch for client&server C++ support in Visual Studion 2008 and 2010 environment (while waiting for it's improved version from issue THRIFT-1031 which is still under development and currently supports client side only) you need to make two more smaller changes, and your Win C++ Thrift powered project will work like a charm.

These interventions are needed for THRIFT-1123 and possibly THRIFT-1031

1. C++ code generated by Thrift compiler have compile errors if you define enums (some ambigious STL iterator as interpreted in Visual Studio) in .thrift file. The solution is easy and published as THRIFT-1139.

2. When communicating between WIN32 client and servers on one side and other implementation such as Java on the other side, double values are not correctly interpreted as current C++ Thrift implementation don't recognise WIN32 environmant and decides to use wrong byte order (endianness). This does not affect int, string, complex and collection types, but affects double. The solution is easy and I'm providing it both inline and as a patch. It has been  tested on Windows and transmited MBytes of collections/comples types/ints/doubles etc. between Java and C++.
Here is the solution, provided both inline and as "additional_thrift_cpp_visual_studio_2008_and_2010_endians_patch(concerning_ticket_1123_and_possibly_1031_patches).patch". To use this patch, just make sure that the main, "thrift_msvc_client_and_server.patch", is already applied.

{code:title=TProtocol.h|borderStyle=solid}

//around line 97 of TProtocol.h

//#if __BYTE_ORDER == __BIG_ENDIAN
#if __BYTE_ORDER == __BIG_ENDIAN && !defined(WIN32)

//around line 118 of TProtocol.h
//#elif __BYTE_ORDER == __LITTLE_ENDIAN
#elif __BYTE_ORDER == __LITTLE_ENDIAN || !defined(WIN32)

{code} 


      was (Author: dragan.okiljevic):
    To use this patch for client&server C++ support in Visual Studion 2008 and 2010 environment (while waiting for it's improved version from issue THRIFT-1031 which is still under development and currently supports client side only) you need to make two more smaller changes, and your Win C++ Thrift powered project will work like a charm.

These interventions are needed for THRIFT-1123 and possibly THRIFT-1031

1. C++ code generated by Thrift compiler have compile errors if you define enums (some ambigious STL iterator as interpreted in Visual Studio) in .thrift file. The solution is easy and published as THRIFT-1139.

2. When communicating between WIN32 client and servers on one side and other implementation such as Java on the other side, double values are not correctly interpreted as current C++ Thrift implementation don't recognise WIN32 environmant and decides to use wrong byte order (endianness). This does not affect int, string, complex and collection types, but affects double. The solution is easy and I'm providing it both inline and as a patch. It has been  tested on Windows and transmited MBytes of collections/comples types/ints/doubles etc. between Java and C++.
Here is the solution, provided both inline and as "thrift_cpp_visual_studio_2008_and_2010_endians_patch(concerning_ticket_1123_and_possibly_1031).patch". To use this patch, just make sure that the main, "thrift_msvc_client_and_server.patch", is already applied.

{code:title=TProtocol.h|borderStyle=solid}

//around line 97 of TProtocol.h

//#if __BYTE_ORDER == __BIG_ENDIAN
#if __BYTE_ORDER == __BIG_ENDIAN && !defined(WIN32)

//around line 118 of TProtocol.h
//#elif __BYTE_ORDER == __LITTLE_ENDIAN
#elif __BYTE_ORDER == __LITTLE_ENDIAN || !defined(WIN32)

{code} 

  
> Patch to compile Thrift server and client for vc++ 9.0 and 10.0
> ---------------------------------------------------------------
>
>                 Key: THRIFT-1123
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1123
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C++ - Library
>         Environment: Windows XP 32bit, vc++ 9.0, 10.0
>            Reporter: Dragan Okiljevic
>            Priority: Trivial
>             Fix For: 0.7
>
>         Attachments: thrift_msvc_client_and_server.patch
>
>
> Extension of THRIFT-1031 patch published by James Dickson
> This patch is intended to provide Thrift C/C++ functionality on WIN32 platforms.
> The implementation is built on top of the patch "Patch to compile Thrift for vc++ 9.0 and 10.0" by James Dickson published as THRIFT-1031. I just used this code and ported more Thrieft C/C++ to WIN32 and added them to original VC projects created in THRIFT-1031.
> I express my gratitude to Mr. Dickson as his post gave me the roadmap how to do the additional changes, that I hope, would be useful for the rest of the community too.
> Besides client capabilities enabled in THRIFT-1031, the library can now be used for building Thrift servers and using concurrency features. The dir/file structure from THRIFT-1031 and usage of Config.h header for providing support for both WIN32 and *NIX remains.
> The implementation was tested briefly on MSVC2008, MSVC2010 and Ubuntu, communicating between C/C++ clients and servers and Java clients and servers. As the author needs all of this functionality for one of his projects, the testing and debugging will continue.
> Revision 1086435 from March, 28, 2011. was used for development and creation of patch, but it should be possible to apply it on current trunk revision as long as no changes are made to patched files in trunk.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira