xp下使用thrift
来源:互联网 发布:ismo软件 编辑:程序博客网 时间:2024/06/12 05:20
从服务器上来看,thrift最早的版本为thrift0.6.0,在2011年发布的。thrift并不是很重视windows的用户,知道0.8.0版本才支持windows下编译。其中,相关文档也不更新,开发使用起来确实有点无奈~
尤其对xp版本的相关文档少之又少,正常在win7开发完的动态库客户端接口在win7下不能用,同时boost也要重新编译,所调用的库不一样。
为了便于其他人在xp下使用thrift,需要改以下内容,进入到thrift-0.8.0\lib\cpp\src\windows修改为如下代码:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */#ifndef _THRIFT_WINDOWS_CONFIG_H_#define _THRIFT_WINDOWS_CONFIG_H_ 1#if defined(_MSC_VER) && (_MSC_VER > 1200)#pragma once#endif // _MSC_VER#ifndef _WIN32#error This is a MSVC header only.#endif#pragma warning(disable: 4996) // Depreciated posix name.#pragma warning(disable: 4250) // Inherits via dominance.#define VERSION "0.8.0"#define HAVE_GETTIMEOFDAY 1#define HAVE_SYS_STAT_H 1#include "TargetVersion.h"#include "GetTimeOfDay.h"#include "Operators.h"#include "TWinsockSingleton.h"#include "WinFcntl.h"#include "SocketPair.h"// boost#include <boost/cstdint.hpp>typedef boost::int64_t int64_t;typedef boost::uint32_t uint32_t;typedef boost::uint8_t uint8_t;// windows#include <Winsock2.h>#include <ws2tcpip.h>#pragma comment(lib, "Ws2_32.lib")// pthreads#if 0#include <pthread.h>#elsestruct timespec {int64_t tv_sec;int64_t tv_nsec;};#define USE_BOOST_THREAD 1#define ctime_r( _clock, _buf ) \ ( strcpy( (_buf), ctime( (_clock) ) ), \ (_buf) )#endiftypedef ptrdiff_t ssize_t;// Missing functions.#define usleep(ms) Sleep(ms)#if WINVER <= 0x0502#define poll(fds, nfds, timeout) \ poll_win32(fds, nfds, timeout)inline int poll_win32(LPWSAPOLLFD fdArray, ULONG fds, INT timeout){ fd_set read_fds; fd_set write_fds; fd_set except_fds; FD_ZERO(&read_fds); FD_ZERO(&write_fds); FD_ZERO(&except_fds); FD_SET(fdArray[0].fd, &read_fds); FD_SET(fdArray[0].fd, &write_fds); FD_SET(fdArray[0].fd, &except_fds); timeval time_out = {timeout * 0.001, timeout * 1000}; return select(1, &read_fds, &write_fds, &except_fds, &time_out);}#else//新加入的inline int poll(LPWSAPOLLFD fdArray, ULONG fds, INT timeout){ fd_set read_fds; fd_set write_fds; fd_set except_fds; FD_ZERO(&read_fds); FD_ZERO(&write_fds); FD_ZERO(&except_fds); FD_SET(fdArray[0].fd, &read_fds); FD_SET(fdArray[0].fd, &write_fds); FD_SET(fdArray[0].fd, &except_fds); timeval time_out = {timeout * 0.001, timeout * 1000}; return select(1, &read_fds, &write_fds, &except_fds, &time_out);}<span style="white-space:pre"></span>//所需要屏蔽掉的//inline int poll(struct pollfd* fdArray, ULONG fds, INT timeout) {//return WSAPoll(fdArray, fds, timeout);//}#endif // WINVERinline void close(SOCKET socket){ ::closesocket(socket);}#endif // _THRIFT_WINDOWS_CONFIG_H_修改完之后还要重新编译一版boost,编译脚本如下:
bjam.exe --toolset=msvc-10.0 architecture=x86 address-model=32 link=static --build-type=complete --with-system --with-thread --with-date_time --with-filesystem --with-serialization release
好了~~这样就可以正常使用了~~~如有问题再留言~~
0 0
- xp下使用thrift
- windows下使用thrift
- ubuntu下安装使用Thrift
- Thrift windows下cpp编译与使用
- thrift使用
- Thrift使用
- xp下使用EXchange管理器
- xp下Qt Creator使用
- win下使用thrift生成gen-php文件代码
- windows下使用thrift编译+示例+详解解决坑
- 在windows下使用vs2013编译thrift 0.10.0
- windows下编译thrift
- ubuntu下安装thrift
- fedora下安装thrift
- MAC下thrift安装
- Mac下安装Thrift
- mac下安装thrift
- ubuntu下安装thrift
- 用字体在网页中画icon图标
- 观看maven视频记录
- 在windows操作系统中使用linux
- ArrayAdapter<T>,Filter实现列表搜索
- Python GUI编程各种实现的对比
- xp下使用thrift
- 关于CLR、CIL、CTS、CLS、CLI、BCL和FCL。
- iOS学习----------正则表达式
- Java中声明常量为什么用static修饰
- 27个提升效率的iOS开源库推荐
- 黑马程序员----java基础面向对象特点及封装
- 引子
- 第 3 章 自定义数据库表结构
- 【PHP】PHP中__get()和__set()的用法实例详解