caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Ocaml on android and ios
@ 2011-06-21  5:39 SerP
  2011-06-21 15:12 ` [Caml-list] " SerP
  0 siblings, 1 reply; 2+ messages in thread
From: SerP @ 2011-06-21  5:39 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1823 bytes --]

Hello! I have been developing a framwork on ocaml for mobile platforms. The
main idea is to create a universal 2D framework for game development. I
started with porting "sparrow" http://www.sparrow-framework.org framework
from objc to ocaml.

Repository https://github.com/serp256/Lightning. The repository does not
include the entire project yet, I will commit the rest as soon as
possible. I have successfully launched the project on iOS, and SDL version
on macosx and linux.

Now I'm trying to port it on android, and after that there will be an
official release of the framework with the first game on it.

However, I encountered an unclear issue.

When I tried to launch it on android, I received an errorr sigsegv which
always occurs on ocaml_startup in case objects are used in the code.

To compile ocaml for android I'm using the patch from "
http://www.itpl.co.jp/ocaml-nagoya/index.php?ocaml-android".

I don't know very well arm assembler, but I'm trying to solve this problem.
Can someone from the maillist help me


=== test_stub.c ===
#include <jni.h>
#include <android/log.h>


jint JNI_OnLoad(JavaVM* vm, void* reserved) {
  __android_log_write(ANDROID_LOG_DEBUG,"LIGHTNING","JNI_OnLoad from stub");
  char *argv[] = {"android"};
  caml_startup(argv);
  __android_log_write(ANDROID_LOG_DEBUG,"LIGHTNING","caml initialized");
  return JNI_VERSION_1_6; // Check this
}
=======
==== test.ml ===
let a = 1
====

ocamlfind -toolchain android ocamlopt -c test_stub.c
ocamlfind -toolchain android ocamlopt -c test.ml
ocamlfind -toolchain android ocamlopt -output-obj -o libtest.so test.cmx
test_stub.o
cp libtest.so ../libs/armeabi/
--- Here as usual compile android project, and it's ok!

When I write in test.ml
====
let a _ = object method render () = () end

It's SIGSEGV on ocaml_startup. It's magic for me!

[-- Attachment #2: Type: text/html, Size: 2770 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Caml-list] Re: Ocaml on android and ios
  2011-06-21  5:39 [Caml-list] Ocaml on android and ios SerP
@ 2011-06-21 15:12 ` SerP
  0 siblings, 0 replies; 2+ messages in thread
From: SerP @ 2011-06-21 15:12 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]

Problem was fixed. argv - must be NULL terminated :-)

On Tue, Jun 21, 2011 at 9:39 AM, SerP <serp256@gmail.com> wrote:

> Hello! I have been developing a framwork on ocaml for mobile platforms. The
> main idea is to create a universal 2D framework for game development. I
> started with porting "sparrow" http://www.sparrow-framework.org framework
> from objc to ocaml.
>
> Repository https://github.com/serp256/Lightning. The repository does not
> include the entire project yet, I will commit the rest as soon as
> possible. I have successfully launched the project on iOS, and SDL version
> on macosx and linux.
>
> Now I'm trying to port it on android, and after that there will be an
> official release of the framework with the first game on it.
>
> However, I encountered an unclear issue.
>
> When I tried to launch it on android, I received an errorr sigsegv which
> always occurs on ocaml_startup in case objects are used in the code.
>
> To compile ocaml for android I'm using the patch from "
> http://www.itpl.co.jp/ocaml-nagoya/index.php?ocaml-android".
>
> I don't know very well arm assembler, but I'm trying to solve this problem.
> Can someone from the maillist help me
>
>
> === test_stub.c ===
> #include <jni.h>
> #include <android/log.h>
>
>
> jint JNI_OnLoad(JavaVM* vm, void* reserved) {
>   __android_log_write(ANDROID_LOG_DEBUG,"LIGHTNING","JNI_OnLoad from
> stub");
>   char *argv[] = {"android"};
>   caml_startup(argv);
>   __android_log_write(ANDROID_LOG_DEBUG,"LIGHTNING","caml initialized");
>   return JNI_VERSION_1_6; // Check this
> }
> =======
> ==== test.ml ===
> let a = 1
> ====
>
> ocamlfind -toolchain android ocamlopt -c test_stub.c
> ocamlfind -toolchain android ocamlopt -c test.ml
> ocamlfind -toolchain android ocamlopt -output-obj -o libtest.so test.cmx
> test_stub.o
> cp libtest.so ../libs/armeabi/
> --- Here as usual compile android project, and it's ok!
>
> When I write in test.ml
> ====
> let a _ = object method render () = () end
>
> It's SIGSEGV on ocaml_startup. It's magic for me!
>
>

[-- Attachment #2: Type: text/html, Size: 3132 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-21 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-21  5:39 [Caml-list] Ocaml on android and ios SerP
2011-06-21 15:12 ` [Caml-list] " SerP

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).