我怎样才能得到JHC到了Android NDK进行合作?到了、JHC、NDK、Android

2023-09-06 13:32:51 作者:徒手敬岁月

JHC是一个Haskell编译其中便携式生成C code,然后调用编译器后端进行的可执行文件。

我需要倾倒的江铃控股的运行时系统的头文件和库,因此在Android NDK可以用它来编译生成的C code。

另外,我需要弄清楚如何在Android API链接到JHC。

基本上,我怎么能插JHC到了Android NDK后台?

编辑:我做了使用的NDK的构建工具,JHC可以使用,建/工具/ make-standalone-toolchain.sh一个独立的编译器。现在我需要找出一种方式,JHC编译我的程序到一个共享对象库,以及如何获得JHC不要求一个主的功能。

EDIT2:我有以下targets.ini并编译脚本。奇怪的是共享库加载失败。

  [机器人]
CC =臂的Linux androideabi-GCC
CFLAGS + = -shared -fPIC -rdynamic -Wno-所有
GC =静态
executable_extension =的.so
合并= mle32
 

 #!/ bin / sh的

JHC --cross -mandroid \
  - 主= Main.android_main \
 HS / Main.hs -o库/ armeabi / libnative活性和放大器;&安培;
蚂蚁调试和放大器;&安培;
蚂蚁调试安装
 

解决方案

我想通了这个问题。 我没有把函数调用app_dummy()在我的android_main功能启动。

Android Go 终于来了,Google 想要靠它获取下一个 10 亿用户

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.