How do I use a 3rd party C library in Xcode for my iphone project? - iphone

love this site and all helpful people! I'm newbie to Xcode and iPhone programming but I've pretty much got the hang of using the SDK to make programs in Obj-C (simple programs right now but make me happy). My experience is web programming (such as PHP and Perl) and I'm not really used to a lot of the new Xcode/desktopy-app stuff like static libraries and linking and such. I be honest, I am not total awesome programmer yet!
I have a problem right now, my (card game) program I am writing needs to use this C library. I don't really understand how I get the proper C files and integrate them into my project so I can start using the commands in that tutorial to evaluate hand values.
I hope I have been clear, please let me know if there is anything I am leaving out. Unfortunately, my newbieness may prevent from me making everything so clear and sometimes I can't english perfectly what I am thinking!
Happy thanks in advance, looking forward to any help!

Couple things:
The library you linked to is quite large. Pokersource appears to be a large C project containing all sorts of things like language bindings and some GUI tools as well. A project that large certainly has an IRC channel. I would recommend going there.
The library you linked to appears to be (I may be wrong about this), licensed under the GPLv3. This means that any program that you distribute to others that uses a GPLv3 library or piece of code must also be licensed under the GPLv3. The upshot is that if you use that library, you'll have to release the source for your game.
The site you linked to does seem to have a long list of other poker hand evaluators, so its possible one of them is suitable for your needs.
Good luck!

it's totally possible to use third party static libraries with your iPhone and using Xcode. This webpage illustrates the process of doing it.

Related

Can XCUITEST can implement the cucumber Feature files

Can we write the Feature files and step definitions in Swift Automation framework using XCUITEST Framework ?Is yes , Any jar files or plugins we need to install ?
I am unable to find much support in this
While this is not an appropriate question for StackOverflow, I will oblige you an answer with Cucumberish. I have used it in the past, it works, but I generally steer clear of third party frameworks as they add a layer of complexity and leave you in the lurch if they lose support.
I have worked a bit with CucumberSwift and got it to work fine, reading German-language Feature files and letting me define steps in Swift using all the functionality that XCUITest provides.
However, we have not adopted this in the end but are writing Feature files in Gherkin and then write ordinary XCTestCases that we link to the Feature files by mentioning Scenario names in comments. We develop the same functionality for three platforms and it was difficult to see how BDD tooling would work across all three or how we could make it work given the resources we have. Like Mike Collins we also felt that running without the complexity of additional frameworks was an added benefit.
Having said this, CucumberSwift seems promising, perhaps check out this discussion about documentation and add to it?

What is a good resource/method for me to learn making Qt GUIs for Perl?

I am decent with Perl, and I've chosen to start learning making GUI interfaces for my Perl programs. That said, I've found it hard to learning how to make a GUI with Qt. I have the bindings from http://code.google.com/p/perlqt4 which seem to be the most recent, but as to how to use them I'm still a bit stumped. All the books and tutorials on the net that I can find are either geared towards using Qt with C++ or with Python.
I'm an absolute Qt beginner and would like to learn how to use it with Perl, but unfortunately the net seems scarce on material for me to use. I can make a GUI design with QtDesigner but don't know how I can fit the code that it generates together with Perl. I can copy the examples from http://code.google.com/p/perlqt4/source/browse/qtgui/examples/tutorial , but those are simple programs withe no accompanying documentation that would allow me to know what is going on or why the code was written that way.
I don't know how Qt or the bindings work but I'd like to learn. Everything that I can find is either obsolete or written for bindings for other languages which I don't understand. I was hoping that some people who've already done this would give me some solid advice or point to some good resources so that I could start learning.
If making a GUI is what you want to do, please consider CitrusPerl that builds on top of wxPerl which is nothing more than a wrapper around wxWidgets. It also makes it very easy to create installers or packagers with the use of Cava Deployment Tools.
TIMTOWTDI
After struggling a further day with the stuff qt4 + perl ..it works in that (stackexchange) way. I use a standard debian wheezy distribution with the packages libqtcore4-perl and libqtgui4-qt etc. Sources from Chris Burel can be found under CPAN or GIT. Regards

C++ static library to be used in XCode

This is probably not a simple question so I am not looking for a definite answer but just some pointers to get me in the right direction.
I have absolutely no experience with C/C++ but have good knowledge of Objective-C. I also don't know much about different compilers and architectures so please be nice if I am talking stupid :)
I have some MatLab code that needs to be ported to Objective-C to run on an iPhone application. My first tentative path to get this done would be to check if MatLab can export the code as a static C/C++ library that I can call from within my Objective-C code.
This seems to be the case but I am not entirely sure what to do next, and what things I need to keep in mind when compiling the library on the MatLab side (i.e. architecture, compatibility, PC vs Mac, etc).
I have been provided with a .DLL and .LIB files which I believe are Windows compiled so they will not be useful for me, is this correct? From working with previous static libraries I can see they all have a .a extension - what do I need to do to get one that is compatible with the iPhone architecture?
And once I get the library compiled, how to I import and use it within my project? Will I just be able to call the public methods directly from within my code?
What else do I need to know or be aware of?
Any help is very much appreciated!
Thanks,
Rog
Static libraries contain binary code tailored for some specific operating system and platform. That means that it will use the OS to internally acquire memory (if it uses dynamic memory) or to perform any other OS specific operation (logging, output).
Even if the generated code was completely OS-agnostic (basic math could be implemented without OS support), the platform is completely different, matlab will generate code for an intel platform and the iPhone runs in an ARM architecture, with a different instruction set calling conventions...
Unless matlab is able to generate static libraries for the iPhone or at the very least for an ARM platform and make it OS-agnostic, you are out of luck.

Common LISP on iPhone/iOS

Is it possible to call a Common Lisp function in iOS?
If so, is it possible create it in a dynamic library?
It depends on what you mean by calling a CL function, but most likely ECL will be your shortest path. Start here, as there is a patch for ECL to better accommodate iOS: http://funcall.posterous.com/tag/iphone
ECL generates C code, so you should be in safe territory with Apple's shifting policies.
Have you tried MOCL?
According to the website "mocl is a highly optimizing CL implementation, delivering tight native code via LLVM/Clang".
Maybe you can create a dynamic library, though it is designed for use the other way around.
Clozure Common Lisp (CCL) runs in Linux on the ARM, and Gary Byers long ago made an experimental iPhone version, but it would only run on a jail-broken iPhone. The problem is that the CCL compiler writes executable code, but iOS out-of-the-box does not allow a writable page to be made executable, so you can't ever RUN that code.
We've had discussions about putting the code that ships with an iOS app be in a read-only code section, and adding a byte-code compiler, so that code created at run-time can be fairly quickly interpreted, but nobody has offered to fund that project, so it hasn't gotten done.
You might think that we could just interpret code created at run-time, but the current CCL "interpreter" compiles non-trivial code before executing it.
MOCL is probably your best option to write code callable from other apps, but that's only a guess, since I haven't used it.
You could use Gambit Scheme or Clozure Common Lisp, both are able to interface with Cocoa, the first because it generates C and the latter because there is a bridge from Clozure to Cocoa. Do a google search about it and you will find a few things.
You might want to keep an eye on this (new) project. It will be publicly available during October 2019: EQL5 iOS EQL5 iOS libs
There also exists Mobile Common Lisp1

iPhone SDK Quick Reference

Is there a quick-reference guide to the iPhone SDK that's as fast and easy to use as one of those little O'Reilly books, or JavaDoc?
I'm new to iPhone SDK programming. I need reference material. Let's say I want to know if the string class has a "reverse" function. For Java I go to http://java.sun.com/javase/6/docs/api/ and browse down to find "String". Then I can see everything about String, with hyperlinks to Serializable and Character. I don't see a "reverse" method, but look, there's a hyperlink to StringBuilder -- aha, there's StringBuilder.reverse(). Total elapsed time 30 seconds.
For the iPhone I go to http://developer.apple.com/iphone and log in. Everything seems to be slower here. There are fewer cross-links than in the Java documentation, and each link seems to pull in a big page that takes a long time to load. Just the page for NSString takes 30 seconds to load fully. Maybe I just don't know my way around the documentation yet, but it seems to be much harder to browse for what you want. There's no equivalent of flipping through a book, or if there is it takes 30 seconds to turn the page.
The iPhone platform is immense -- for almost anything you'd want to do, there's got to be a class somewhere that does it. The built-in help in XCode is good but I'm still lost with it.
How do YOU go about finding that class you need? Is there a better way?
I just use XCode's built-in help system. Right-click a class or symbol name, and choose "Find Selected Text in API Reference". You can also do "Jump to Definition", which will open the header file where that symbol is defined.
More info on this stuff here.
When I started with iPhone dev I used the iPhone Developers Cookbook, it has examples of how to do specific things. It's easy to pick out one piece of functionality to try out.
I'd highly recommend checking it out.
Use the XCode hot keys to jump to documentation on anything - in XCode for Leopard, you can double-click on something like "NSString" while holding down "Option" and it will take you to the documentation for that class. You can do the same thing for method names.
In Snow Leopard that key combo opens up a little help box with a summary of what you clicked on, "Cmd-Option double-click" brings up the docs as with Leopard.
The built in docs are very good and even provide links to sample code (if any exists for the subject in question).
There's also a way to generate your own XCode compatible documentation with Doxygen, just like you could with Javadoc:
http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
If the speed of browsing documentation is the issue, I recommend downloading the related doc sets and browse them locally in Xcode. In Xcode's preferences, select the last "tab" (Documentation) and click the "GET" button next to the documentation test you want. (I'm on Snow Leopard and Xcode 3.2, but it should be similar on Xcode 3.1.x as well.)
If finding what you need is the issue, I second #paulsnotes's answer — the "cookbook" approach is very helpful form a task-based exploration standpoint. Also, when you find something you were looking for, and it took much longer than usual, provide feedback on Apple's documentation. Each page has links at the bottom. You can suggest what classes, sample code, etc. would be useful to cross-link to make it easier to find what you need.
If we are recommeding books, this is excellent for a beginner, it gets you up to speed very quickly while leading you through creating highly functional apps you can use as a jumping point for your own:
Beginning Iphone Development