0

I have a Java app from which I am calling the functions in a (Delphi) DLL. I'm using JNA to do so.

The DLL, once initialised, starts it's own thread and monitors the status of a system. Control is returned to the java app in it's own (Main) thread.

What options are there to signal the Java App from my DLL thread, in a thread-safe manner, that an event has occurred? If this were a Windows app I'd probably post a window message or thread message.

What choices do I have in this case, apart from polling?

I've looked around for similar queries but could not find answers to my question. Thanks in advance.

Ana Loureiro
  • 45
  • 1
  • 5
  • Posting a message to a window would work. Calling a function would work. Setting an event would work. There are a great many options, and as such that makes this question unsuitable here. – David Heffernan Jul 18 '16 at 13:31
  • Some options for Delphi -> Java are Sockets, [Memory Mapped Files](http://stackoverflow.com/questions/22153377/java-nio-memory-mapped-files), [Named Pipes](http://stackoverflow.com/questions/634564/how-to-open-a-windows-named-pipe-from-java) – mjn42 Jul 18 '16 at 13:31
  • This is in-process and so IPC is not needed – David Heffernan Jul 18 '16 at 13:31
  • You can use JNA to send a Windows message. See for example http://stackoverflow.com/questions/15050750/java-jna-sendmessage-not-found – mjn42 Jul 18 '16 at 13:34
  • 1
    You can also pass a Java callback as a parameter to the native function: https://jna.java.net/nonav/javadoc/overview-summary.html#callbacks – Ondrej Kelle Jul 18 '16 at 14:47

0 Answers0