Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
19 views

Gluon and JNA/JNR [duplicate]

I used JNA with GLUON before and had no problems. Everything worked. I tried replacing JNA with JNR. When I run mvn gluonfx:runagent , JNR runs successfully. However, after mvn clean gluonfx:build ...
Aleksey Timofeev's user avatar
0 votes
0 answers
176 views

java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider

I am using docker and colima setup to run automation tests locally and encountering this error, that does not seem to start docker. Error message: java.lang.UnsatisfiedLinkError: could not load FFI ...
Syed Hussain's user avatar
0 votes
0 answers
35 views

JNR-FFI - Callback Pointer crash

I'm using the Win 32 library. I'm trying to call a callback with a pointer. But when called, the function does not complete, but causes an error. Example of DLL initialization: Csclink csc = ...
ordinal's user avatar
2 votes
1 answer
169 views

Why does Rust native library randomly crash when calling function?

In Rust, I have a function that compresses an array: fn create_bitvec(data: Box<[u8]>) -> [u8; 49152] { let mut bit_vector = [0u8; 49152]; for (index, &value) in data.iter()....
hello planet's user avatar
1 vote
2 answers
435 views

How can I call a function from JAVA/JNA if I only know the offset from another function?

I know that in libaaa.so there is an exported (the symbol is in the text/code section) function obj1() at address 0x12345 from the start of the library. CLibrary libaaa = (CLibrary)Native.load("...
Jerome Ibanes's user avatar
1 vote
0 answers
128 views

How to graceful shutdown in java with jnr-posix?

Java doesn't seem to have any default way of catching process signals. I found out the jnr-posix module that I am willing to use, and this is what I wrote so far package org.projectsanatan.restsanatan;...
EkaSaffronGaruda's user avatar
-1 votes
1 answer
236 views

How to handle a SIGSEGV with jffi / jnr?

The Java VM crash with a SIGSEGV in a docker container. On all other systems it is working as expected. # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=...
Horcrux7's user avatar
  • 24.4k
2 votes
1 answer
7k views

Could not load FFI provider when using module-info.java

My Linux Java application uses bluetooth devices. I use this library in order to communicate with bluez stack : https://github.com/hypfvieh/bluez-dbus. It worked very well until I added module-info....
VladRia's user avatar
  • 1,577
0 votes
2 answers
630 views

How to use defrecord in Clojure to extend a Java class?

From my research, the way to extend a Java class is basically with either gen-class in a namespace or with proxy. But looking at the Clojure type selection flowchart, it seems to suggest that I can ...
Kenny Ho's user avatar
  • 3,397
6 votes
1 answer
1k views

How to copy native memory to DirectByteBuffer

I know one way - using memcpy on C++ side: C++ method: void CopyData(void* buffer, int size) { memcpy(buffer, source, size); } JNR mapping: void CopyData(@Pinned @Out ByteBuffer byteBuffer, @...
sgnsajgon's user avatar
  • 704
3 votes
0 answers
381 views

How to return a struct by value using JNR?

I'm trying to work with the openh264 native library from Java code using JNR. The function I'm calling is defined in openh264's C header file to return a simple struct by value: typedef struct ...
zakgof's user avatar
  • 301
10 votes
1 answer
847 views

How to return by value from native function?

I have the following C++ method compiled using Visual Studio 2017: extern "C" __declspec( dllexport ) Info* __stdcall GetInfo(InfoProvider* infoProvider) { static_assert(std::is_pod<Info>::...
sgnsajgon's user avatar
  • 704
6 votes
1 answer
315 views

how to specify a JNR Pointer like that of python ctypes

Using python's ctypes, it's possible to specify a pointer that takes a type: class METADATA(Structure): _fields_ = [("classes", c_int), ("names", POINTER(c_char_p))] With JNR, it ...
zcaudate's user avatar
  • 14.2k
2 votes
0 answers
305 views

jnr-ffi Mapping to C Libray Crashes when calling c function

I have a key value database which is written in C with following functions to set and get values. typedef uint64_t ARK; #define ARC ARK int ark_set(ARK *ark, uint64_t klen, void *key, uint64_t vlen, ...
Riyaz's user avatar
  • 116
1 vote
0 answers
674 views

Read from unix socket file

I'm trying to read some lines (or just something) from /var/run/docker.sock. Basically I'm trying to convert the following into code. curl --unix-socket /var/run/docker.sock http://localhost/events ...
user672009's user avatar
  • 4,565
0 votes
1 answer
344 views

Packet.dll get mac address (JNR-FFI)

How does one map the function below to java with jnr-ffi? BOOLEAN PacketRequest(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData); Example (C): https://github.com/patmarion/winpcap/...
Ardika Rommy Sanjaya's user avatar
1 vote
1 answer
982 views

How can I force the usage of a class from a particular jar and exclude same class of another jar in build.sbt?

I have two asm dependencies that have exactly the same class names and project structures included by different dependencies. Although these libraries have the same project structure, they have ...
user avatar
3 votes
0 answers
1k views

Cannsandra Driver & jnr-Unixsocket - java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider

I am using cassandra and jnr-unix socket in my project and both uses jnr-ffi. Not getting any error in my local, but getting error in test env. The versions are, Cassandra version - 3.3.2 jnr-...
user1578872's user avatar
  • 8,968
2 votes
1 answer
863 views

JNR-FFI how to read array of structs from pointer to pointer

I am trying to interface with a C library libzbc using jnr-ffi. There is a function: int zbc_list_zones ( struct zbc_device * dev, uint64_t sector, enum zbc_reporting_options ro, ...
Sidias-Korrado's user avatar
1 vote
1 answer
568 views

JNR-FFI crash after calling c function copying struct

I am trying to interface with a C library libzbc using jnr-ffi. The first function call zbc_open works and returns a pointer to a open device. Then the next call to zbc_get_device_info causes a JVM ...
Sidias-Korrado's user avatar
14 votes
2 answers
7k views

What is the difference between JNA and JNR

According to the image from here both libraries work according to the same principle. But I believe that there is a difference between them. What is this difference?
user avatar
0 votes
1 answer
659 views

JNR UnsatisfiedLinkError

This question might be related to this and a ton other UnsatisfiedLinkError questions. I'm trying to run the following code. import jnr.ffi.LibraryLoader; import jnr.ffi.types.pid_t; /** * Gets ...
Vasantha Ganesh's user avatar
1 vote
1 answer
228 views

How to get UID and GID in jnrfuse

I am implementing filesytem using fuse and jnrfuse.Can someone tell me how to get the UID and GID info in jnrfuse?
Praveen's user avatar
  • 57
1 vote
2 answers
488 views

jnr-ffi: Is there a generation tool from header files to java code

Is there a tool that generates java code from header files for the project jnr-ffi. I what to offer an API for a C-project with approx. 1200 functions.
notes-jj's user avatar
  • 1,547
1 vote
3 answers
3k views

How to use a struct with a struct in jnr ffi

I have the following c code: #include <stdio.h> struct Second { int a_number; }; struct Top { struct Second second; }; void lets_go(struct Top *top) { printf("The number is %d\n",...
kmp's user avatar
  • 10.8k
0 votes
1 answer
282 views

__stdcall with JNR

I'm using JNR and trying to call to __stdcall function. I've already tried to load library with stdcall() convention: mTemplateApi = LibraryLoader.create(FPTemplateAPI.class).stdcall().load("...
goto1134's user avatar
  • 107
2 votes
2 answers
2k views

UnsatisifedLinkedError : Could not locate stub library in jar file

I am trying to use this jnr-jffi library. It appears to have a dependency on jffi so I have also built that and included in my libs folder. My code to load the native code is as follows: MATH_LIB = ...
jim's user avatar
  • 9,098
1 vote
1 answer
480 views

Fuse filesystem in java - JVM error double free or corruption

I'm writing a Fuse-Filesystem in java using the jnr-fuse library (https://github.com/SerCeMan/jnr-fuse) which internally uses JNR for native access. The filesystem works as a frontend to an Amazon S3 ...
Michael Langowski's user avatar
2 votes
1 answer
4k views

App running under SBT doesn't find a class from Classpath jar

I have a Scala project using sbt. It runs perfectly well under Eclipse, however, trying to run it under sbt (sbt 'run mount 1440' — including the parameters I need) leads to a ...
Ilia Ershov's user avatar
1 vote
1 answer
267 views

Extract process environment before exit from java-initiated command line command or shell script

I would like to read/dump the environment variables of a process (.sh file, command line invocation, etc) that I initiate from inside java. For example, I have a shell script that runs and sets an ...
Constance Eustace's user avatar
3 votes
0 answers
198 views

How to map a C-struct with bitfields in JNR?

I have the following struct that i want to map using JNR-FFI. Note that this struct contains bitfields. Unfortunatly there is no JavaDoc or any other kind of doc available. typedef struct _DCB { ...
Chriss's user avatar
  • 5,609
2 votes
0 answers
116 views

JNA equivalent of JNR's ObjectReferenceManager?

JNR has this thing called the ObjectReferenceManager that makes keeping track of references really convenient. An object is passed to it and a unique id (a Pointer, but it's really just an id afaik) ...
user's user avatar
  • 5,370
5 votes
2 answers
1k views

Callback/closure with JNR taking a pointer argument

I'm using JNR and trying to pass a callback function with the following C-equivalent signature: int fn(void const*, void const**, void**) into some C function. I have declared the callback nested in ...
user's user avatar
  • 5,370
1 vote
1 answer
485 views

how to use java jnr to infer a clib struct

Is there a way for jnr to construct a struct for me in order to access a returned call using jnr. for example, if I wanted to use int statvfs(const char *path, struct statvfs *buf); where struct ...
zcaudate's user avatar
  • 14.2k