Skip to main content

All Questions

Tagged with
1 vote
1 answer
214 views

JNA: Callback returns null value

I am using custom types in the callback method and always get an empty value. What could be the problem? C code in dll(i have .h file for this dll): typedef union { char caStruct[16384]; struct ...
RamirLanner's user avatar
2 votes
1 answer
547 views

Pointer to a function in java

I have a dynamic link library (DLL) written in c++. In my DLL I have a function like this: void set_event_callback(EVENT_CALLBACK callback_fcn); where EVENT_CALLBACK is a function pointer like this: ...
reza's user avatar
  • 63
0 votes
0 answers
87 views

JNA callback method wont be called until futureTask.get() timeout

If I run like this, the callback block will not run so future.get() will block forever: FutureTask<Long> futureTask = new FutureTask<>(System::currentTimeMillis); boolean login = ...
King K's user avatar
  • 1
2 votes
0 answers
72 views

Is the WindowProcedure always called in the JavaFX Application Thread?

In a JavaFX app, if I use the JNA to implement a custom window procedure, will the callback always be on the JavaFX Application Thread? public class MyWindowProc implements WinUser.WindowProc ... ...
vbyzjnlehi's user avatar
0 votes
1 answer
71 views

Is is possible to specify a JNA callback programmatically?

I know how to specify a JNA callback (C to Java) the regular way, like for example: C header: static void (*InvokerInst)(int, int); __declspec(dllexport) int start(); __declspec(dllexport) void ...
Hervé Girod's user avatar
0 votes
1 answer
309 views

Copy data from an unmanaged memory pointer to a managed unsigned byte array in Java

I have a c# code I am trying to implement in Java using JNA currently stuck in returning a preview image during my device scan process C# [DllImport("RS_SDK.dll", CharSet = CharSet....
Samuel Moshie's user avatar
1 vote
1 answer
207 views

How can I delay return of CallNextHookEx or PostMessage to simulate delayed mouse events?

My mouse does occasional double clicks and now I'm trying to build a tool that detects invalid mouseup/mousdowns and blocks them from being propagated. The double-clicks are actually triggered by the ...
Gernot Raudner's user avatar
1 vote
1 answer
153 views

JAVA-JNA : I can't modify a structure field throughout a callback function

I have a problem with JNA callbacks. In my JAVA program I use a function pointer that will be called by a native library. This function pointer is: public int callback(S_CODELINE_INFO codelineInfo) { ...
Nabil CHERQAOUI's user avatar
1 vote
1 answer
114 views

Jvm crash when second call to the callback happens

I using JNA to call native library My callback interface public interface PPAEvent extends Callback{ void callback(int eventCode, int opCode, String Data); } I have a callback implementation ...
Ahamed Hak's user avatar
1 vote
0 answers
231 views

JNA - callback method with typedef struct** argument

I am using C dll with this code: 1) AIC_BRIDGE_API AIC_ERROR_CODE aic2_set_cb_function ( void (*cb2_start_dsts) (AIC2_DSTS_START_STOP), void (*cb2_stop_dsts) (AIC2_DSTS_START_STOP), ...
iv_ski's user avatar
  • 11
0 votes
1 answer
45 views

why am I not getting any output when a method with a callback is called?

I am trying to call a method which is in a C DLL through Java. But I am not getting any output nor any exceptions. Below is my C code. typedef void (*rfid_data)( uint32_t data_id, uint32_t ...
AnOldSoul's user avatar
  • 4,137
2 votes
2 answers
2k views

JNA callback function with pointer to structure argument

I am busy with a project in which I have to do native calls to a proprietary C library. I came across JNA, which seems to be tried and tested with a number of successful projects. I am having trouble ...
bouwerp's user avatar
  • 313
1 vote
1 answer
3k views

Using JNA, how do I create a 'C++ class' and pass it to a C++ function,?

I need to call a proprietary DLL function with the following prototype (simplified for clarity): int J_Image_OpenStream(J_IMG_CALLBACK_OBJECT obj, J_IMG_CALLBACK_FUNCTION function); The type ...
Mark Jeronimus's user avatar
0 votes
1 answer
516 views

Pass a raw function pointer where the JNA definition expects a Callback?

I'm working with a JNA interface that expects a Callback. I have the raw address of a native function g, which is the function I want to install as a callback. I am calling native function f, which ...
0xbe5077ed's user avatar
  • 4,705
2 votes
1 answer
2k views

C++ binary to Java gets "java.lang.Error: Invalid memory access"

I have a Java library interfacing (via JNA) with a native C++ DLL. This DLL provides functions to set callbacks that are invoked when certain hardware events occur. All of these callbacks work except ...
Sharparam's user avatar

15 30 50 per page