This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define COLOR_(msg, color, ctl) \ | |
"\033[0;" #ctl ";" #color ";m" msg "\033[0m" | |
#define COLOR(msg, color) \ | |
"\033[0;" #color ";m" msg "\033[0m" | |
#define BLACK(msg) COLOR(msg, 30) | |
#define RED(msg) COLOR(msg, 31) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
最近做Android开发的人越来越多,Android开发难免会遇到调用本地库,这就需要采用JNI技术,JNI本身并不复杂,但大多数开发者在类型转换上遇到麻烦,今天特地将几种常用类型转换写成一个实例来告诉大家如何转换,尤其是Java的类和C的结构的转换,结构体中嵌套结构体如何处理,这部分网上的资料也比较少。 | |
1. 编写Java类 | |
package com.jinhill.util; | |
public class NativeModule { | |
public native int testArg(int i, boolean b, char c, double d); |