Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get JHC to cooperate with the android ndk?

JHC is a Haskell compiler which portable generates C code and then invokes a compiler backend to make an executable.

I need to dump the header files and libraries for JHC's runtime system, so the android ndk can use it to compile the generated C code.

Alternatively, I need to figure out how to link the android API into JHC.

Basically, how can I plug JHC into the android ndk backend?

Edit: I've made a standalone compiler using one of the ndk's build tools that JHC can use, "build/tools/make-standalone-toolchain.sh" . Now I need to figure out a way for JHC to compile my program into a shared object library, and how to get JHC to not demand a "main" function.

Edit2: I have the following targets.ini and compile script. Strangely the shared library fails to load.

[android]
cc=arm-linux-androideabi-gcc
cflags+= -shared -fPIC -rdynamic -Wno-all
gc=static
executable_extension=.so
merge=mle32

and

#!/bin/sh

jhc --cross -mandroid \
 --main=Main.android_main \
 hs/Main.hs -o libs/armeabi/libnative-activity &&   
ant debug &&
ant debug install
like image 795
Molossus Spondee Avatar asked Apr 24 '12 21:04

Molossus Spondee


1 Answers

I figured out the problem. I didn't put the function call "app_dummy()" at the start of my "android_main" function.

like image 185
Molossus Spondee Avatar answered Sep 28 '22 16:09

Molossus Spondee