Common LISP on iPhone/iOS
Asked Answered
K

6

15

Is it possible to call a Common Lisp function in iOS?

If so, is it possible create it in a dynamic library?

Kitchen answered 30/10, 2010 at 19:40 Comment(1)
Most answers here are outdated. It is not clear if the product mentioned still work, still produce linkable code which can actually be used in production: LLVM, arm64, bit compiling. Latest information on MOCL, which looks promising, is one year old.Mossgrown
B
8

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.

Bituminize answered 31/10, 2010 at 23:8 Comment(3)
"Posterous Spaces is no longer available" :\Seda
@Seda web.archive.org/web/20130323055046/http://funcall.posterous.com/… ; links to github.com/kriyative/ecl-iphone-builder/tree/elf and github.com/kriyative/ecl-iphone-builder/tree/dragon and mclide.in-progress.com .Forkey
Not relevant anymore for iOS. ECL patches used to support up to XCode 4.3 . Now Xcode requires LLVM, arm64 and both frameworks and static libraries need to be compiled with Bitcompile enabled. Current version of Xcode is 7.1 .Mossgrown
B
4

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.

Banka answered 9/8, 2013 at 10:6 Comment(6)
$199 Standard License, $1299 EnterpriseStately
mocl (what you call "Common Lisp for iOS and Android") does, in fact, allow you to export your CL functions such that they can be called from Obj-C or Swift.Citizenry
Does anybody know the CURRENT STATUS of MOCL? Is it being actively developed? Does it support newest LLVM bit compiling inside XCode ? Latest available info is now one year old... Do you have any news?Mossgrown
It appears to be supported, generates ARM64 as well. It is only a static subset of CL: no macros outside "compile time", no eval.Mossgrown
If you are looking for Open Source, MOCL is a no go, way too expensive.Scammony
I am surprised why they will not give away a free copy for non-commercial use. Without a developer community who likes it or who can take it ahead for commercial use, how are they going to get critical mass?Banka
F
3

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.

Feverish answered 19/9, 2015 at 16:21 Comment(0)
D
1

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.

Detain answered 31/10, 2010 at 1:55 Comment(2)
I did a couple google searches and I don't see how either of these is going to help. Gambit is a different programming language. Clozure doesn't have a Darwin/ARM port (closest ports are Darwin-x86 and Linux-ARM).Bendite
Gambit looks promising on paper, but it does not produce C sources which can be compiled within current Xcode (7.1) anymore. There appears to be some partial attempt at supporting LLVM. In its current status it is unusable. Clozure supports Objective C binding, but AFAIK it never worked on iOS.Mossgrown
A
1

You might want to keep an eye on this (new) project. It will be publicly available during October 2019: EQL5 iOS EQL5 iOS libs

Ankylosis answered 29/9, 2019 at 12:52 Comment(0)
C
0

There also exists Mobile Common Lisp1

Canvass answered 13/8, 2013 at 5:32 Comment(1)
Did you actually use it, recently?Mossgrown

© 2022 - 2024 — McMap. All rights reserved.