Can I code for iPhone in Vala?
Asked Answered
S

2

12

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.

Selfinductance answered 1/2, 2011 at 0:29 Comment(3)
How are you coding for an iPhone? All the threads I've read about trying to code with other languages, or on windows or Linux, come back to the same thing - the only combination that works is Objective C, Apple APIs and XCode on a Mac.Pournaras
You can code in c or c++ too. You would need to wrap all calls to apple API in c as the API is accessed from objective c. Since my game works on OpenGL the only calls I had to wrap was for the context creation and not much more. The rest can be in c. Ooc and vala compiles to c. I'm on a mac.Selfinductance
One thing you'll need to watch out for is the use of any module that targets desktop OpenGL, because many of the things they do there do not port across to OpenGL ES. You'd need to write code that uses that API if you want it to work on the iPhone.Potion
D
5

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.

Delegate answered 2/2, 2011 at 10:48 Comment(4)
And can GLib be compiled for iphone?Selfinductance
@Damian, I don't know. I know more about Vala than iOS. In any case, it's not officially supported.Delegate
With Apple, AFAIK, if it's not officially supported by Apple, chances are your app won't make it through certification.Crocodilian
Vala is just "transformation" to C so no issues with Apple!! The problem is GLib normally links dynamically and that is prohibited on iOS. Vala needs a fork without glib........Offal
C
1

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.

Chaunce answered 20/1, 2016 at 11:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.