Jump to content

  • Log In with Google      Sign In   
  • Create Account


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 $(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 += -landroid 


And here is my Application.mk file:


APP_PROJECT_PATH := D:/binrev/repository/bar

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

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

APP_ABI := armeabi-v7a


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:




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)


include $(CLEAR_VARS)
LOCAL_SRC_FILES := bar/bar.cpp

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

LOCAL_LDLIBS := -llog 
LOCAL_LDLIBS += -landroid 

LOCAL_STATIC_LIBRARIES += android_native_app_glue

$(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",
        LOGI("Library successfully loaded!");
        if (dlsym(lib, "bar") == NULL) {
            fprintf(stderr, "Symbol 'bar' is missing from shared library!!\n");        
            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:




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

APP_ABI := armeabi-v7a

APP_STL := gnustl_static
APP_GNUSTL_CPP_FEATURES := rtti exceptions



  Are those functions actually not working?