Keep on going, never give up.

gSOAP移植到NDK

把gSOAP移植(最新版本2.8)到NDK方法非常简单,但就是编译不过:(,总是报告stdsoap2.cpp:933: error: invalid conversion from 'size_t*' to 'socklen_t*'错误,自己又不敢贸然去修改,最后一个老外找到解决方法,希望gSOAP下个版本可以修正。关于gSOAP介绍:gSOAP入门开发实例

要修正该问题,需修改两个地方:

1、stdsoap2.h 第823行附近

修改前:

#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) ||defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) || defined(__QNX__)
|| defined(QNX) || defined(OS390) || defined(HP_UX) 
# define SOAP_SOCKLEN_T socklen_t

修改后:

#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) ||defined(FREEBSD) || defined(__FreeBSD__) || defined(OPENBSD) || defined(__QNX__)
|| defined(QNX) || defined(OS390) || defined(HP_UX) || defined(__ANDROID__) 
# define SOAP_SOCKLEN_T socklen_t

2、stdsoap2.cpp 第3630行附近

修改前:

#if defined(__GLIBC__) || (defined(HAVE_GETHOSTBYNAME_R) && (defined(FREEBSD) ||defined(__FreeBSD__)))
if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host,&soap->errnum) < 0)
host = NULL;

修改后:

#if defined(__GLIBC__) || (defined(HAVE_GETHOSTBYNAME_R) && (defined(FREEBSD) ||defined(__FreeBSD__))) || defined(__ANDROID__) 
if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host,&soap->errnum) < 0) 
host = NULL;

三、MAKEFILE增加__ANDROID__宏定义

附Makefile.am文件:

AUTOMAKE_OPTIONS = foreign

noinst_LIBRARIES = libgSClient.a

libgSClient_a_SOURCES = \
		gSClient.cpp \
		soapC.cpp \
		soapClient.cpp \
		soapClientLib.cpp \
		gSClient.h \
		soapdrmspProxy.h \
		soapH.h \
		soapStub.h \
		stdsoap2.cpp \
		stdsoap2.h

INCLUDES = 

AM_CXXFLAGS = -DLINUX -D__ANDROID__

参考地址:http://markmail.org/thread/452l4mc2my7fcc6n

本文最后更新:20120917

相关评论(0):  

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

订阅博客

最新文章

本站采用创作共用版权协议, 要求署名、非商业用途和保持一致. 转载也必须遵循“署名-非商业用途-保持一致”的创作共用协议. 返回顶部
Copyright@2005-2016 Metsky.com, All rights Reserved.