iOS problems using c++ code which invoke epoll() - c++

I knew that iOS apps could use shared C++ library. However, now I have some C++ code that uses epoll() function, and iOS is based on a BSD kernel that doesn't have epoll() function, so when I integrate these C++ code to my iOS xcode project, there are some compile error, such as "sys/epoll.h file not found" and so on.
How could I do now? Thanks for any help!

Related

Xamarin.Forms + native library OpenCV

I'm trying to write an application using Xamarin.Forms. But I need to connect to the project native library OpenCV.
In tutorial i see how connect to the ios or android project. But I want use this native library in share code.
Library OpenCV has Android, Linux, Windows, iOS and Source Code versions. I would like to write code for this library once.
this is url for this library http://opencv.org/downloads.html
Please, help solve the problem
I don't think there's a way to have one codebase when using native bindings on iOS and Android. However, you can automate everything by using SWIG (http://www.swig.org). Short example here: http://blog.reblochon.org/2013/01/c-bindings-for-monotouch-using-swig.html
There's also .NET port of OpenCV called EMGU which works fine with Xamarin.

C++: `CHttpConnection` & `CInternetSession` OS X / LLVM Clang equivalent?

I'm trying to translate some c++ code that was made using Microsoft Foundation Classes (MFC) and compiles with Microsoft Visual Studio 2010+ so that it can be executed in Xcode. It's a class that makes a connection to an API, and so it uses the MFC classes CHttpConnection and CInternetSession. What's the closest equivalent for Mac/Xcode users? If context is needed, see the header file in the "How to connect through the API using C++" section on this page. Thanks in advance.
If you're on OSX then you're likely working with ObjC & Foundation. If so then the closest OSX equivalents would likely be NSURLConnection, NSURLRequest, and NSURLSession (as far as I know the api is the same for iOS and OSX). If you're not dealing with ObjC on OSX and/or you really need a C++ implementation of those MFC types, then you'll probably have to roll them yourself using sockets.
(Actually, there's nothing that prevents you from using libcurl or libwget - the C libs behind a couple of the examples from your link. At the very least they might save you some time.)

Compiling/Running C++ code on iPhone without convert to Objective C

I wrote my project on Visual studio 2010 and I used on it tesseract ocr library , Opencv and Cvblob , and now want change it to from desktop application to mobile application on iPhone so can I compiling and running it without convert to Objective C ?!
Well, you can compile and run straight C or C++ on iOS. You can even inline it in Objective-C classes.
But you will still need Xcode (and thus a Mac) to build and deploy, and you will not be able to just use code you built against Windows frameworks.
It seems tesseract does not currently support iOS, so if you require that and can't port it yourself, you probably can't just port your app to iOS without rewriting major parts of it. But that isn't just a question of programming languages.

Does this networking library work on iOS?

I want to use this library for cross platform networking.
http://lacewing-project.org/
It works with OSX, Linux, Windows and has specific code for Android. What I do not know is if it will work (as a client) on iOS. (meaning I will not host a server on iOS)
Since it uses POSIX sockets internally does that make it compatible with iOS?
Thanks
Without trying it, my guess would be that it would work. You will need to write your UI in Objective-C, but you should be able to use Objective-C++ to bind your libraries to the UI. Before you start into the Objective-C++ path be aware of the limitations (see: How well is Objective-C++ supported?).
I would try using the objective-c library AFNetworking first, from the creators of gowalla.
You can get it here:
https://github.com/AFNetworking/AFNetworking
On the topic of lacewing, it should work fine, as long as it relies upon the BSD sockets API, as I can confirm that it exists on iOS.
If it's only written in C/C++ then no, unless you got a C/C++ SDK for iOS (which AFAIK does not exist publicly). iOS SDK is for Objective-C.

How to run run C++ apps in android?

How to run c++ applications in android using cygwin. Any tutorial in this regard is appreciated..
You cannot directly run C++ applications in Android.
Android can run only applications written using the Android SDK, but yes you can re-use your native(C/C++) libraries for Android.
You will have to recompile all the native libraries specifically for Android. And you do need the source code for all 3rd party native libs you plan to use simply because Usually when we compile and link these libraries outside Android they are linked to glibc but unfortunately Android doesn't use glibc due to liscence and performance issues. Android uses a watered down version of glibc called libc. It has matching symbol names to glibc for most of the usual functionalities. But as far as i know the libc doesn't have some functionality related to Strings and it definitely doesnt have some posix support. If your native libraries are using any of the deprecated functionality you will have to find workaround for those by using alternative functionality supported by libc and coding your libs accordingly.
Also, you will have to use the NDK to interface Java(Android app/fwk) to native world(C++). And then write a Android application on top of that.
Though this sounds pretty simple in my experience compiling native libraries on Android(Android porting) has traditionally been very time consuming with no guarantee of sucesses.
You will want the Java Native Interface, or "JNI".
See: "Java Native Interface Wiki" "Android JNI Tips" and links therein. It is some work to get this going and to get used to how it goes. I managed it from the references given here with C and it will work out after some time and faith without further help if you follow all the steps.