native-code

How to use ported library in NaCl module?

谁都会走 提交于 2019-12-13 00:34:11
问题 I want to use openssl library in my NaCl module. Luckily it is ported already as in https://code.google.com/p/naclports/. However, its kind of pity but I don't know how to add the library to the toolchain. I did as instructed in the Readme file: ...nacl_sdk/pepper_33/naclports/src$ python build_tools/naclports.py install openssl Already installed 'openssl' [x86_64/newlib] And then I tried to compile this simple C code, and the compiler complaint some errors which are because of linking

Debugging Android native application using ndk-gdb

喜你入骨 提交于 2019-12-12 18:07:29
问题 I am trying to debug my android application having some native(c++) code using ndk-gdb in eclipse.It seems that by gdb server starts successfully from command line and is taking commands. But in eclipse it is showing this error : Error while obtaining file from device com.android.ddmlib.SyncException: Writing local file failed Any one help me please. 回答1: It seems that the framework for debugging requires an obj/local/armeabi folder. If you open the launch file for native debugging, .metadata

Supporting “for each” on custom const native C++ container class

会有一股神秘感。 提交于 2019-12-12 11:28:56
问题 I'd like to implement a simple native C++ fixed-capacity array template class, supporting the range-based "for each" syntax for convenience, with minimal overhead. I'm having trouble with supporting it on const instances. With this implementation: template< class T, size_t Capacity > class List { public: List() { mSize = 0; } const T* begin() const { return mItems; } const T* end() const { return mItems + mSize; } T* begin() { return mItems; } T* end() { return mItems + mSize; } private: size

How to control the execution of an externl native DLL

大憨熊 提交于 2019-12-12 07:00:36
问题 I have this code in .NET: result = NativeMethods.gsapi_init_with_args(_ghostScriptInstance, args.Length, _argumentPointersHandle.AddrOfPinnedObject()); That in its turn executes this code [DllImport("C:\\gsdll64.dll", EntryPoint = "gsapi_init_with_args")] public static extern int gsapi_init_with_args(IntPtr instance, int argc, IntPtr argv); The problem is that because of yet unknown problem the native execution enters into an infinite loop and never returns. The question is how can I cap the

C# Anti-Debug method OutputDebugString doesn't work right

北城以北 提交于 2019-12-12 05:32:17
问题 So recently I've been reading up on anti-debug mechanisms and a popular method I've come across to check if the current process is being debugged is OutputDebugString . I've written this piece of code but it doesn't exactly work as intended can someone shed some light on why or what I'm doing wrong? private static bool stub_OutputDebugString() { uint ErrCode = 0x12A6; Native.SetLastError(ErrCode); Native.OutputDebugString("System.Core\n"); if (Marshal.GetLastWin32Error() == (int)ErrCode) { /

Moving native libraries from android app to system lib and accessing it from app

一个人想着一个人 提交于 2019-12-12 03:05:44
问题 I have compiled one native code with android ndk. Now instead of keeping that library as part of .apk i want install it in android system (system/lib64) and my application load from system. I pushed the library to the system/lib64 and deleted the libraries from the android application's lib folder. But when i try to run i am getting "java.lang.UnsatisfiedLinkError: dlopen failed: library "something.so" not found" Following is my makefile LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL

phonegap android native function not getting called

折月煮酒 提交于 2019-12-12 02:57:47
问题 my html code in /assets/www <!DOCTYPE html> <\html> <\head> <\title>FileReader Example</title> <script type="text/javascript" charset="utf-8" src="cordova-2.6.0.js"></script> <script type="text/javascript" charset="utf-8"> function onLoad() { console.log("in onLoad"); document.addEventListener("deviceready", onDeviceReady, false); execute(success, fail, "Echo", action, [args,"1","2"]); console.log("in at end of onLoad"); } function onDeviceReady() { console.log("in onDeviceReady"); } function

Create JAVA class from C code

心不动则不痛 提交于 2019-12-11 00:57:36
问题 I have Class in java called XMLDOMDocument this class have some methods CreateXML , AddNode , RemoveNode etc. I call this methods from C code with the help of Java Native Interface, but for doing that I pass to the C code object of my JAVA class then by calling env->GetObjectClass(myclass) I get my class from that object and call methods of the JAVA class. I want to know can I do same thing (call JAVA methods) without passing my class to the C code. Can I create JAVA class right in C code and

How does ngen works?

a 夏天 提交于 2019-12-10 11:24:00
问题 So, from what I understand, it does take an executable/dll file written in MSIL and does the JIT-job: convert MSIL code to native machine code. Right? So ran the ngen to generate a native image of my program using the command: ngen install myProgram.exe It take a while but I found the generated file is at C:\Windows\assembly\NativeImages_v4.0.30319_32\myProgram\db1496cf0295bbe6a9242d86c0d8e091\myProgram.ni.exe But what's exactly the contents of that executable file? a machine code version of

How to Debug native code using ndk-gdb

蹲街弑〆低调 提交于 2019-12-10 10:24:00
问题 This is what I am getting after running ndk-gdb according to many tutorials when it links to you to (gdb) server you have to type continue but what after that how to debug the code there after. In my case it displays Continuing and remain like this. WHat i have to do further I am totally clueless. Arathore@chd-arathore-AND /cygdrive/d/All_Work/All_ARathore/All_Workspace_Practice/ndkfoo $ /cygdrive/d/All_Required_Stuff/Android/android-ndk-r8e/ndk-gdb --verbose --adb=/cygdrive/D/All_Required