从本地code加载纯粹FMOD [英] Loading FMOD purely from native code

查看:274
本文介绍了从本地code加载纯粹FMOD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现所谓的NativeActivity的在FMOD例如文件夹中的例子,但不幸的是它使用一些Java code:

I found an example called nativeactivity in FMOD example folder, but unfortunately it use some java code:

package org.fmod.nativeactivity;

public class Example extends android.app.NativeActivity 
{
    static 
    {
        System.loadLibrary("fmodex");
        System.loadLibrary("main");
    }    
}

Android.mk看起来是这样的:

Android.mk looks like this:

LOCAL_PATH := $(call my-dir)

#
# FMOD Ex Shared Library
# 
include $(CLEAR_VARS)

LOCAL_MODULE            := fmodex
LOCAL_SRC_FILES         := libfmodex.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/inc

include $(PREBUILT_SHARED_LIBRARY)

#
# Example Library
#
include $(CLEAR_VARS)

LOCAL_MODULE           := main
LOCAL_SRC_FILES        := main.c
LOCAL_LDLIBS           := -llog -landroid
LOCAL_SHARED_LIBRARIES := fmodex
LOCAL_STATIC_LIBRARIES := android_native_app_glue

include $(BUILD_SHARED_LIBRARY)

$(call import-module,android/native_app_glue)

是否有可能没有java的一部分吗?如果是的话我会需要改变?

Is it possible to do without the java part? If so what would I need to change?

推荐答案

我不知道你为什么想摆脱的Java的这几行。据我所知,这对您的应用程序的其他部分没有任何影响。

I don't know why you want to get rid of these few lines of Java. To the best of my knowledge, this has no effect on the rest of your application.

您需要的Java的原因是,Android系统加载器无法找到 libfmodex.so libghost.so <解析引用这是必不可少/ code>。因此,负载libghost.so 失败。 Java允许您preLOAD依赖你的库加载之前。

The reason you need Java is that Android system loader cannot find libfmodex.so which is essential to resolve the references in your libghost.so. Therefore, load of libghost.so fails. Java lets you preload the dependency before your library is loaded.

不幸的是,NativeActivity的本身只能加载一个库。 已经张贴在2012年4月一个要求改善这种状况一段时间未来。

Unfortunately, NativeActivity itself can only load one library. A request has been posted in April 2012 to improve the situation some time in the future.

目前,您可以切换所有code,与作品的 FMOD ,以动态链接,或兴建第三共享库将加载的 FMOD ,然后装入库。在这种情况下,加载器将能够解决的鬼引用,因为 FMOD 就已经被载入。

Currently, you can switch all your code that works with fmod to dynamic linking, or build a third shared library which will load fmod and then load the ghost library. In this situation, the loader will be able to resolve the references in ghost because fmod will already be loaded.

这篇关于从本地code加载纯粹FMOD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆