简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM