3

I am writing code in java which calling delphi dll. to invoke the delphi dll I am usig JNA and its work great. My problem is when events are being called in the delphi and I need to invoke java code. is this possible in JNA?

  • You might find the following link to be of some use : http://stackoverflow.com/questions/16501194/loading-a-delphi-dll-in-java-using-jna – Peter May 26 '13 at 08:12
  • I have alraedy saw this post, this post talk about invoke delphi functions from java, and I need to invoke java code from delphi, and I Know there is the JNI, but I hope that JNA can do that too – Eran Friedland May 26 '13 at 11:41

1 Answers1

3

As discussed on the related thread (loading a delphi dll in java using jna), the flow is:

  • create dll in delphi
  • create a delphi or c++ app that can load the dll and successfully call the funcs in it --- do not proceed until this is done!
  • now load dll from JNA

The interesting part for your project is that you want the delphi code to invoke java code.

I can think of only two ways to achieve the delphi --> java flow:

  • Implement a callback on the java side, so the delphi code can pump java code when needed (How to use JNA callback)

  • Have the delphi dll start a thread (that is bad, better: in java start a thread which loads a delphi dll func that runs) and use a different kind of IPC for the delphi code to pump java code (via a socket, shared memory, or other technique)

Community
  • 1
  • 1
Jonesome Reinstate Monica
  • 6,618
  • 11
  • 65
  • 112