Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use Clojure CLR with C# in Xamarin?

I love Clojure. It is by far my favorite language.

I've just found Xamarin, which allows you to have cross-platform apps, making full use of native libraries. The language used with it is C#.

Now I'm wondering if there is any way to program the majority of my Xamarin apps in Clojure (CLR), instead of C#.

like image 322
Luke Martin Avatar asked Apr 30 '13 03:04

Luke Martin


1 Answers

So, Clojure CLR will let you use any libraries it can load. For example, I've loaded the Oracle.DataAccess libraries, and the NLog libraries into Clojure CLR, so it's theoretically possible to load the Xamarin libraries the same way:

;;; not sure which library you want to include, using this as a placeholder
(assembly-load-from "C:/Path/To/Xamarin.Core.dll")

That being said, Xamarin itself appears to also be an IDE, and a set of build tools on top of their own proprietary libraries and build tools, so it may not be possible to fully integrate the two. Also, I think Xamarin works purely with C#, so coding in Clojure is probably not possible...directly.

What you can do is create some libraries in Clojure CLR, and compile them down to DLLs, which you can then link to, so you can build the bulk of your logic in Clojure, and then create some simple C# wrappers that your Xamarin app consume.

I'd love to hear back on what you try, and whether or not you're successful doing this.

Best of luck!

like image 103
Maurice Reeves Avatar answered Sep 23 '22 19:09

Maurice Reeves