From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p5LFCpSn028142 for ; Tue, 21 Jun 2011 17:12:51 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Al4CAH+0AE5KfVM2kWdsb2JhbAApFQEDEp5qAYccYggUAQEBAQkLCwcUBCGIcyWiQIw9gkeEdjmIZgEBAwaGJASHHIpKiSiCUzyDVA X-IronPort-AV: E=Sophos;i="4.65,401,1304287200"; d="scan'208";a="111628461" Received: from mail-gw0-f54.google.com ([74.125.83.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 21 Jun 2011 17:12:45 +0200 Received: by gwb15 with SMTP id 15so1694276gwb.27 for ; Tue, 21 Jun 2011 08:12:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=7NsRteUDmm0uQaO4nFTy2Qoa4Jn7vESZGqVXC19B298=; b=H7SeRQkP9RjR5+6NsF9bzFGfbjVN5u8SQyN2ty0PLymgAZCpdsQDA3l0OCcFmqcMDY 8Ielg06yPfQpt5X6l6eh52CFMm3YGYB+sZeYw+soCiaZ87yRsEfKQeOojIbmFTI1WJxe tkP8vwUbxIAMk0ZMTSDvrj2/6mfaB2s2ilXVc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ZWSeqaR3oRRHZjMzOXLjJJl5xaLGNa23Uc/Pm1c6mFCU6a8tOMTvKpNCQYa/oQVvKb 7RM2yeWk6YO6rw2qRO8PsrGeExpL5FIOL1axWCx8NHMAdd0e68nJgqzljwRo5MNC2R2J vNzVz2hloKb1/wIMK4fwxCkh5wPecZUR06xzk= MIME-Version: 1.0 Received: by 10.236.136.6 with SMTP id v6mr11180707yhi.410.1308669164190; Tue, 21 Jun 2011 08:12:44 -0700 (PDT) Received: by 10.236.47.135 with HTTP; Tue, 21 Jun 2011 08:12:44 -0700 (PDT) In-Reply-To: References: Date: Tue, 21 Jun 2011 19:12:44 +0400 Message-ID: From: SerP To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=20cf303ddce4a8fa6c04a63a48e9 Subject: [Caml-list] Re: Ocaml on android and ios --20cf303ddce4a8fa6c04a63a48e9 Content-Type: text/plain; charset=ISO-8859-1 Problem was fixed. argv - must be NULL terminated :-) On Tue, Jun 21, 2011 at 9:39 AM, SerP 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 > #include > > > 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! > > --20cf303ddce4a8fa6c04a63a48e9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Problem was fixed. argv - must be NULL terminated :-)

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

Hello! I=A0have been developing a framwork on ocaml for mobile platforms= .=A0The main idea is to create a universal 2D framework for game developmen= t.=A0I started with porting "sparrow"=A0http://www.sparrow-framework.org= =A0framework from objc to ocaml.

Repository=A0https://github.com/serp256/Lightning.=A0The repository does not= include the entire project yet, I will commit the rest as soon as possible= .=A0I have successfully launched the project on iOS, and SDL version on mac= osx and linux.

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

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"= .=A0

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


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


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

ocamlfind -toolchain android ocamlopt -c te= st_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
=3D=3D=3D=3D
let a _ =3D object method ren= der () =3D () end

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


--20cf303ddce4a8fa6c04a63a48e9--