Alex Rivera | Logout

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

Asked 2012-04-24T21:00:11.150
17

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
Edit
Report

1 Answer

2

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

answered 2012-04-25T22:41:02.610

Your Answer