connecting to web service from freebsd or other OS - web-services

i will explain my problem and please try to help me
i want to access a web-service from Point-Of-Cell Handheld
its SDK use C language on eclipse
at first i wanted to learn how to access web-services from C or c++ LANGUAGE
and i succeeded in this using gsoap library and i can access a web-service using it.
i modified the stdsoap2.c file to can fit the handheld library as i modified tcp-connect and tcp-send and tcp-receive and so on
my problem here there is alot of errors in this file, it is run time error as memory fail or pthread fail and so on
my director told me that it is because this file is for windows and ask me to search for gsoap version work on another platform
he tried the Linux version but it didn't work too
he asked me to search for a copy that work on embedded system or on FreeBSD OS
is he right? and is there any copy of gsoap can satisfy my need?

Gsoap is available on FreeBSD. Just install the port from /usr/ports/devel/gsoap
If your code was written for windows, you will have to replace windows-specific functions with those available on FreeBSD.

Related

how to call memcached api in Windows C++

I am trying to use memcached for my windows C++ application, aiming to cache large table contents for performance optimization
This is first time for me to implement caching with open source library, and most memcahed source I have found online are either for Linux only or for 32-bit windows (very out of date), also need docker.
Please let me know if there is any good Windows Memcached source easy to use
One possible resource I have found is: https://github.com/jefyt/memcached-windows
But README just telling you how to install & run memcached from cmd line, there is no hint for how to build and use as an C++ client library in windows, plus, I could not find any example code also
Can anyone point me a direction for how to add memcached as client library to be called in my C++ code on Windows (something like #include <memcached/...> )
Thanks a lot
K

where can I find grpc library for c++ windows and Linux both

I am trying to setup grpc server for a embedded device which runs the C++ environment. I have followed the link at https://github.com/grpc/grpc/blob/master/INSTALL.md, but I am unable to understand what needs to be done there in a order for grpc library to be available or installed in C++ libs.
Setting up grpc for C++, I assume to be having a generic approach for windows/Linux environment apart from the specifics of C++ run time location
The approach at above location says to build, but its failing for me at step,
With error as below,
Anyone if having more detailed link/reference to step by step process would be really helpful
For building gRPC under Windows nowadays, I would highly encourage people to use the provided CMakefile.
We haven't done any work towards supporting cygwin however, and we don't have any plans in supporting it at the moment. Most of the Windows-specific codebase would expect msys/mingw or VC, and I wouldn't be surprised if it would fail at runtime with cygwin even if you manage to compile, as our usage of the Linux API is probably too advanced for cygwin's emulation layer.
The Makefile should potentially behave properly under msys, if you insist on using it.

Can i create application in Windows for Linux platform?

I have around of 4 years experience in C#.Net programming and i am developing a client server application. The server application will be insalled on CentOS and client application will be installed in Windows OS. But, i don't have much knowledge about c++ programming on linux platform. So, my question is that can i create a console application in Windows OS and compile it for linux platform. it is not necessary that compile it on Windows. but, it should be executed in linux platform. I am new in linux programming.
Presently i am using TC++ editor. Can i use Visual Studio 2010 to build server application for linux platform?
if there are another approach then please suggest me.
Thanks.
You can develop the client in C# and the server in C++, if you prefer. Consider that unlike C#, there is no standard socket library yet, and you'll have to rely on either system calls or their higher level wrappers (like boost).
I've to tell you that Windows uses BSD sockets (its own version, with some modifications though), therefore with a few preprocessors checks, you can make your application portable.
In your case, I'd suggest you to go for boost.asio which will hide all low-level stuff for you. It's even cross-platform.
Maybe you can use VS as an editor ; Make sure that you do not include any windows specific libs; There is an option of using cygwin and doing a cross compilation. Check the links
How to cross compile from windows g++ cygwin to get linux executable file
I guess it will be more of a pain. Better use Virtual Box --> linuxMint/Ubuntu + Eclipse with C++ plugin or some other C++ editor...

Cross platform c++ with libcurl

I am a perl developer that has never went into the client side programming of things. I'd like to think that I'm a pretty good developer, except I know that my severe lack of knowledge of the way desktop programming really takes away from my credibility.
That said, I really want to get into doing some desktop applications.
I want to try to develop a simple application that will connect to my server and grab an rss feed, then display it in the console. My plan of attack is to use libcurl (and curlpp) to grab the feed (I'd also like to do more curl stuff in the future). But I want to be able to run this small program on linux, windows, and mac because I want to understand developing cross platform.
So here is the question (and I know it is extremely noobish): How do I write c++ code that will use libcurl and curlpp, and will work on the 3 major OSes? The main thing I don't understand is if I have to compile libcurl and curlpp, then how does it work when trying to take it over to the other platforms?
You need to write the code portably - basically make it a console application. You then transfer the source code (not the exe) to the other platforms and compile it there and link with the version of llibcurl on each specific platform.
Neil is right, but using a framework will make your life easier. Try QT it is very nice. It has a cross platform http API, and integrates curl.
I'd recommend Qt4 as well, I've wrote a small'ish tutorial on how to setup a windows gcc compiler on linux and compile Qt4/OpenSSL with it for windows, hope that helps.
http://www.limitlessfx.com/mingw-openssl-qt4-for-windows-on-linux.html
You can easily adapt that tutorial to compiling libcurl instead of just moving to Qt4.

Write applications in C or C++ for Android? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm trying to develop/port a game to Android, but it's in C, and Android supports Java, but I'm sure there must be a way to get a C app on there, anyone knows of a way to accomplish this?
For anyone coming to this via Google, note that starting from SDK 1.6 Android now has an official native SDK.
You can download the Android NDK (Native Development Kit) from here:
https://developer.android.com/ndk/downloads/index.html
Also there is an blog post about the NDK:
http://android-developers.blogspot.com/2009/06/introducing-android-15-ndk-release-1.html
The Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages.
For more info on how to get started with native development, follow this link.
Sample applications can be found here.
Normally, you have to:
Install Google Android NDK. It
contains libs, headers, makfile
examples and gcc toolchain
Build an executable from your C code
for ARM, optimize and link it with
provided libs if required
Connect to a phone using provided
adb interface and test your
executable
If you are looking to sell an app:
Build a library from your C code
Create simple Java code which will
use this library
Embed this library into application
package file
Test your app
Sell it or distribute it for free
Google has released a Native Development Kit (NDK) (according to http://www.youtube.com/watch?v=Z5whfaLH1-E at 00:07:30).
Hopefully the information will be updated on the google groups page (http://groups.google.com/group/android-ndk), as it says it hasn't been released yet.
I'm not sure where to get a simple download for it, but I've heard that you can get a copy of the NDK from Google's Git repository under the donut branch.
The official position seems to be that this isn't something you'd ever "want to do". See this thread on the Android Developers list. Google envisage android running on a variety of different devices (CPUs, displays, etc). The best way to enable development is therefore to use (portable) managed code that targets the Dalvik VM. For this reason, the Android SDK doesn't support C/C++.
BUT, take a look at this page:
Android includes a set of C/C++
libraries used by various components
of the Android system. These
capabilities are exposed to developers
through the Android application
framework.
The managed application framework appears to be layered on-top of these libraries. The page goes on to list the C/C++ libs: standard C library, media, 3D, SQL lite, and others.
So all you need is a compiler chain that will compile C/C++ to the appropriate CPU (ARM, in the case of the G1). Some brief instructions on how to do this are here.
What I don't know is where to find descriptions of the APIs that these libraries provide. I'd guess there may be header files buried in the SDK somewhere, but documentation may be sketchy/missing. But I think it can be done!
Hope thats useful. For the record, I haven't written any native android apps - just a few simple managed ones.
Andy
You can use nestedvm to translate C (or other GCC languages) into Java bytecode, and use that as the basis of your port. For example, see the Android port of Simon Tathams portable puzzle collection.
I expect this method is made obsolete by the NDK, but it might not be in if some networks or something don't allow people to upgrade their phones.
Google has already launched Google I/O 2011: Bringing C and C++ Games to Android session which is available at http://www.youtube.com/watch?v=5yorhsSPFG4
which is good to understand the use of NDK for writing application in c and c++ for android.
If you just want to cross compile any console based native game and run them on android then this Article has shown 3 methods for the same.
1: Static compilation using standalone toolchain
2: Cross compilation using Android NDK’s toolchain
3: Cross compilation using AOSP source code
Maybe you are looking for this?
http://www.mosync.com/
It is a middle layer for developing for several mobile platforms using c++.
Looking at this it seems it is possible:
http://openhandsetmagazine.com/2007/11/running-c-native-applications-on-android-the-final-point/ (now only available via the WayBack Machine)
"the fact is only Java language is supported doesn’t mean that you cannot develop applications in other languages. This have been proved by many developers, hackers and experts in application development for mobile. The guys at Elements Interactive B.V., the company behind Edgelib library, succeeded to run native C++ applications on the Android platform, even that at this time there is still many issues on display and sound … etc. This include the S-Tris2 game and a 3D animation demo of Edgelib."
Since 2009 there is a development on this matter.
Necessitas - Qt(C++ framework) for Android
Getting started video.
Take a look at google ndk group it looks promising, first version of the NDK will be available in 1H2009.
Update:
And it is released http://android-developers.blogspot.com/2009/06/introducing-android-15-ndk-release-1.html
I'm not sure the NDK provides full coverage of the official Java API.
From http://developer.android.com/sdk/ndk/index.html#overview :
Please note that the NDK does not
enable you to develop native-only
applications. Android's primary
runtime remains the Dalvik virtual
machine.
Google just released the NDK which allows exactly that.
http://feedproxy.google.com/~r/blogspot/hsDu/~3/2foWz7hwFtE/introducing-android-15-ndk-release-1.html
It can be found here:
http://developer.android.com/sdk/ndk/1.5_r1/index.html
This blog post may be a good start: http://benno.id.au/blog/2007/11/13/android-native-apps
Unfortunately, lots of the important stuff is "left as an exercise to the reader".
I do not know a tutorial but a good development tool: Airplay SDK from Ideaworks Labs. (Recently rebranded "Marmelade") Using C/C++ you can build apps for Windows Mobile, iPhones, Android. The only component I didn't like was the GUI composer - a buggy one, but you always can substitute it with the Notepad.
You can download c4droid and then install the GCC plugin and install to your SD. From the shell I just traverse to the directory where the GCC binary is and then call it to make an on board executable.
find / -name gcc
/mnt/sdcard/Android/data/com.n0n3m4.droidc/files/gcc/bin/arm-linux-androideabi-gcc
cat > test.c
#include<stdio.h>
int main(){
printf("hello arm!\n");
return 0;
}
./arm-linux-androideabi-gcc test.c -o test
./test
hello arm!
This three steps are good to have and store in this post.
1) How to port native c code on android
2) http://www.integratingstuff.com/2010/12/12/calling-native-c-code-through-jni-in-android-applications/
3) http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/
Native C/c++ Files libstdc++.* from your Ubuntu are x86 (or x86_64) binaries but Android devices and emulators are ARM. Of course, this will not work anyway, even if you'll set correct soname. This is very naive way which leads nowhere. Android has very limited support of C++ meaning there is no exceptions, standard C++ library (including STL) and RTTI. If you need such functionality, use my custom NDK distribution from
http://crystax.net/android/ndk.php - it support full C++ features listed above.
Why is there error: undefined reference to '__cxa_end_cleanup' link error. Android stlport
time. Because there is no link to libstdc + +. A. So wrong.
Because it uses some static library, it is necessary to link the full libstdc + +. A. Can
http://crystax.net/android/ndk.php here to download the package
sources \ cxx-stl \ gnu-libstdc + + \ libs \ armeabi directory.
Android on its own libstdc + + support is limited, it must be linked to a complete libstdc +
+. A the job.
Add file in Android.mk LOCAL_LDFLAGS = $ (LOCAL_PATH) / libs / libcurl.a \
$ (LOCAL_PATH) / libs / liblua.a \
`$ (LOCAL_PATH) / libs / libstdc + +. A`
And LOCAL_CPPFLAGS + =-lstdc + +-fexceptions can be compiled
There is a plan to allow C/C++ libraries in the next SDK version of Android (Codename Eclair?)To date, it's not possible through the Android Java SDK. However, you can grab the HUGE open source project, roll your own libraries, and then flash your own device...but anyone who wants to use your library will have to flash your custom build as well.
Short answer: You can't.
#Backslash17: Looking through the article and the following link with installation instructions, all the company got working is to launch a self compiled executable on the emulator, bypassing the android framework. Once you have the emulator you can telnet in and have a linux shell. Running a linux program there is trivial of course.
But that's not working for phones without jailbreak(aka root access) and not deliverable on the market.
Unless Google opens other opportunities or someone writes a custom compiler that compiles Language X into Dalvik bytecode (Dalvik is the VM that runs Android programs) you won't be able to write native code.