JNI Native Load Module

JNI 를 이용할때 아래의 코드를 사용하면 편하다.



// native Load Library
	static { loadLibrary("native_sample"); }
	
	/** A helper for loading native libraries stored in "libs/armeabi*". */
	public static boolean loadLibrary(String nLibName) {
		try {
			System.loadLibrary(nLibName);
			DebugLog.LOGI("Native library lib" + nLibName + ".so loaded");
			return true;
		} catch (UnsatisfiedLinkError ulee) {
			DebugLog.LOGE("The library lib" + nLibName + ".so could not be loaded");
		} catch (SecurityException se) {
			DebugLog.LOGE("The library lib" + nLibName + ".so was not allowed to be loaded");
		}

		return false;
	}




댓글

Designed by JB FACTORY