Jump to content

  • Log In with Google      Sign In   
  • Create Account

chris_01

Member Since 15 Nov 2008
Offline Last Active Sep 01 2013 04:01 PM

Topics I've Started

Replace char* with std::vector

01 September 2013 - 08:58 AM

I try to replace a char* to strore data values with a std::vector<uint8_t> m_vec but I fail.

 

To write my data I try:

void addData(unsigned int length, unsigned int size, void* data){
    const uint8_t* ptr = reinterpret_cast<const uint8_t*>(data);
    std::copy(ptr,ptr+size, std::back_inserter(m_vec));
}

To test this I try:

unsigned int test1 = 167;
this->addData(1, sizeof(unsigned int), &test1);

unsigned int value = 0;
memcpy(&value, &m_vec, sizeof(unsigned int));
std::cout << "Return: " << value << std::endl;

But I got an invalid value 4920432.

Any idea what I've made wrong?

 

 


OpenGLES2 Emulator (Angleproject) MinGW64 build fails

17 June 2013 - 02:23 AM

I've to set up an OpenGLES2 runtime environment for my MinGW64 platform. On MinGW32 I have used the PVRFrame emulator successfully. But this emulator does not work on MinGW64. The PVRFrame OpenGLES2 x64 builds (SDK 3.1) could be successfully integrated, but the OpenGLES basic calls (glCreateBuffer/glCreateShader) fails and I couldn't get any valid OpenGL ID ...

 

By this reason I try to set up the angle-project emulator ("Almost Native Graphics Layer Engine" code.google.com/p/angleproject). While the angle-project builds are exclusive for Visual Studio,and I couldn't get a Visual Studio 2012 build working, I've set up an MinGW64 build based on CMake scripts. I could build the angle-project successfully with MinGW64. When I include the dll and lib files to my MinGW64 environment and try to run the angle-project samples, those samples crashes with a Sigfault (got from GDB) on DX call:

 

Program received signal SIGSEGV, Segmentation fault.
0x000000006580c278 in D3DPERF_GetStatus ()
   from d:\binrev\development\msys\mingw64\bin\libEGL.dll

 

 

Has anyone successfully build the angle-project successfully for 64bit platform and maybe get it running with MinGW64? Any idea what could be wrong? Get anyone an other x64 based OpenGLES2 emulator working?

 

Thanks for any help.

 


Prebuild of static library not executed.

22 May 2013 - 04:11 AM

I've implemented a simple static test library foo and perform a successfully build of this library. Now I try to include this library as static prebuild to my simple shared bar library, based on android documentation. But this fails. My shared library is build successfully but my prebuild is not executed (finally not copied).

 

Here ist my bar Android.mk file

LOCAL_PATH := D:/binrev/repository/bar
include $(CLEAR_VARS)

LOCAL_MODULE    := foo-prebuilt
LOCAL_SRC_FILES := external-deps/foo/lib/android/$(TARGET_ARCH_ABI)/libfoo.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)           
LOCAL_MODULE    := bar
LOCAL_C_INCLUDES:= D:/binrev/repository/bar/include
LOCAL_C_INCLUDES+= D:/binrev/repository/bar/external-deps/foo/include
LOCAL_SRC_FILES := src/bar.cpp

LOCAL_LDLIBS := -llog
LOCAL_LDLIBS += -landroid 
 
LOCAL_SHARED_LIBRARIES := foo-prebuilt
include $(BUILD_SHARED_LIBRARY)

 

And here is my Application.mk file:

 

APP_PROJECT_PATH := D:/binrev/repository/bar
APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk 

APP_CPPFLAGS := -std=gnu++0x  
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DDEBUG  

APP_STL := gnustl_static
APP_GNUSTL_CPP_FEATURES := rtti exceptions
APP_OPTIM := debug

APP_ABI := armeabi-v7a
APP_PLATFORM:=android-10          
APP_MODULES := bar

 

I use MinGW64 in hanshake with NDK 8re. I could exclude MinGW64 as possible source of defects, while this failure also occurs, if I perform the build using Windows command line. While the upload is blocked by our proxy you could download the test project here:

 

http://sourceforge.net/projects/binrevengine/files/publications//bar.7z

 

I checked my sources and scripts multiple times, but can't find any failure.

I completly get lost and running out of ideas ...
Thanks for any help.


How to integrate native runtime library with dlopen on NDK?

30 March 2013 - 03:49 AM

For my native c++ project I've to set up a runtime loading of a precompiled shared library, which could be changed by client side on start up using configurations. What is the proper way of calling dlopen on android?  No matter what I do, dlopen can never open any shared library, if I not define this library as precompiled library in my Android.mk file like this:
 
LOCAL_PATH := $(call my-dir)

LOCAL_CFLAGS += -DDEBUG 
LOCAL_CFLAGS += -DANDROID 

include $(CLEAR_VARS)
LOCAL_MODULE := bar
LOCAL_SRC_FILES := bar/bar.cpp
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/bar
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := native_activity
LOCAL_SRC_FILES := main.cpp

LOCAL_LDLIBS := -llog 
LOCAL_LDLIBS += -landroid 

LOCAL_SHARED_LIBRARIES := bar
                  
LOCAL_STATIC_LIBRARIES += android_native_app_glue

include $(BUILD_SHARED_LIBRARY)
$(call import-module, android/native_app_glue)

 

 
In my native activity main class I try to load the library with:
 
  void* lib = dlopen("/system/lib/armeabi-v7a/libbar.so", RTLD_NOW);
    if (lib == NULL) {
        fprintf(stderr, "Could not dlopen(\"libbar.so\"): %s\n",
        dlerror());
        exit(1);
    }else{
        LOGI("Library successfully loaded!");
    
        if (dlsym(lib, "bar") == NULL) {
            fprintf(stderr, "Symbol 'bar' is missing from shared library!!\n");        
        }else{
            LOGI("Library symbol found!"); 
        }
        
        int x = bar(25);
        LOGI("Bar return value: %i", x);
    }

 

 
The disadventage of this implementation is that is not really a runtime loading, because I've to load this library also on JNI startup using JAVA mechanisms.
 
If I remove the bar library precompile defintions from Android.mk, disable JNI loading on startup and add a copy of the precompiled library to the systems/lib folder where it should be (same place where it is stored using precompile definitions), the loading of the library fails.  I've checked the apk package it contains my manually copied library at lib folder as expected.
 
Why this will not work?  Is it possible to perform a strict native runtime library loading of an external precompiled library? And what is the best way to ensure thatmy library is added to the apk package? 

std::string operations (i.e. stol, stoi) not found NDK8d

20 March 2013 - 12:08 AM

I try to set up my first android project using ndk r8d with c++11 support. Some c+11 mechanisms work fine (i.e. lambada expressions), but when i try to use one of the new string operations, the compile fails ( error: 'stol' is not a member of 'std'). Here are my project settings:

 

  Application.mk

APP_MODULES := MyLib   

APP_CPPFLAGS := -std=gnu++0x  
APP_CPPFLAGS += -frtti
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -DDEBUG   

APP_ABI := armeabi-v7a
APP_PLATFORM:=android-14                      

APP_STL := gnustl_static
APP_GNUSTL_CPP_FEATURES := rtti exceptions

NDK_TOOLCHAIN_VERSION=4.7

 

  Are those functions actually not working?


PARTNERS