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?

2
  • You might find the following link to be of some use : stackoverflow.com/questions/16501194/… Commented May 26, 2013 at 8: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 Commented May 26, 2013 at 11:41

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.