Can I code for iPhone in Vala? - iphone

I'm coding a game for iphone in ooc language (a new language that compiles to c) using OpenGL. It's really going well, and ooc is a language I really like. Now I've just found out about Vala and I don't get very well what it means that it relies on GLib and GObject. I've read in another question that Vala depends on GTK, but I don't think it does.
The question is: What I'm doing with ooc, could I do the same with Vala? Can I code in vala an OpenGL game for IPhone? And can be vala code used from c?
Thanks.

Vala's object orientation is implemented using the GObject library, which is part of GLib. It is possible to use Vala without objects, and therefore not requiring GLib, but there's not much point to that.
In any case, to access a C library from Vala, somebody needs to have written a VAPI binding (see Google) for that library. There probably isn't one for Apple APIs, so you'd have to write it yourself - if that's even allowed by the Apple license agreement.

You can find old version of native vala compiler and libgee for iOS in this repo: cydia.radare.org (valac version is 0.15, it is very old). UPD: valac 0.34.4 was added, which is relatively new.
It is possible to compile GLib for iOS, so having vala code compiled should not be a problem. The real difficulty here comes with the bindings as already mentioned, I doubt that someone already has VAPIs for iOS.

Related

Use c++ Code in Unity3D

I am using unity3D for the first time to develop a game.I have written a code in c++ using Opencv and the code consist on many files.Now I want to apply the result computed by c++ code to a 3D character.
How i can use my c++ code in unity.Please help me.Remember I am using OpenCV Libraries in my c++ Code.
Thanks!!
You need to write a DLL file and use it within Unity. There is many examples on how to do so.
http://docs.unity3d.com/Manual/Plugins.html
If you have some money you can also purchase the Unity source code that is written in c++ though that seems a bit overkill.
did some googlefu...
C++ is not a scripting language, and can only be used with Unity in the form of plug-ins (in the Pro version). C# is closer in syntax to C++ than Javascript is.
http://answers.unity3d.com/questions/12809/can-i-use-c-as-a-scripting-lanques-for-unity.html
(couldn't find anything that contradicted that)
although these might be of interest:
https://gamedev.stackexchange.com/questions/82518/is-it-possible-to-use-c-with-unity-instead-of-c
http://blogs.unity3d.com/2014/05/20/the-future-of-scripting-in-unity/

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

syntax highlight with objective-c

i'm looking for a objective-c class that supports syntax hightlighting a string.
is there something like that existing?
this should work on iphone!
Firstly, it really depends on what programming language you need to process, so you should include that.
Secondly, while I don't know of any syntax highlighters that are written in C or ObjC, there are several written in JS. You could load up the code in a UIWebView and run the JS syntax highlighter on it. That would probably work pretty well.
You'll have to do this yourself, unfortunately. But if you check iPhone OS 3.2, there are some helpful bits in there. (There is an NDA in place, so more can't be revealed directly in this public area. Check out Apple's dev forums.)
Though CoreText precisely does what you want in Mac OS X, It's not yet available on iPhone OS 3.1.X. However, Syntax highlighting is far more easier if you use javascript based highlighter as pointed by Colin

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

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.