forked from magnusja/libaums
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
72 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 3.4.1) | ||
|
||
add_library( errno-lib | ||
|
||
# Sets the library as a shared library. | ||
SHARED | ||
|
||
# Provides a relative path to your source file(s). | ||
src/c/errno.c ) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <errno.h> | ||
#include <string.h> | ||
#include <jni.h> | ||
|
||
JNIEXPORT jint JNICALL | ||
Java_com_github_mjdev_libaums_ErrNo_getErrno(JNIEnv *env, jobject thiz) { | ||
return errno; | ||
} | ||
|
||
JNIEXPORT jstring JNICALL | ||
Java_com_github_mjdev_libaums_ErrNo_getErrstr(JNIEnv *env, jobject thiz) { | ||
char *error = strerror(errno); | ||
return (*env)->NewStringUTF(env, error); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.mjdev.libaums; | ||
|
||
/** | ||
* Created by magnusja on 5/19/17. | ||
*/ | ||
|
||
public class ErrNo { | ||
static { | ||
System.loadLibrary("errno-lib"); | ||
} | ||
|
||
public static native int getErrno(); | ||
public static native String getErrstr(); | ||
} |
This file contains 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