[Pharo-users] [ANN] JNIPort for Pharo 3.0 alpha

Tudor Girba tudor at tudorgirba.com
Mon Mar 31 15:25:04 EDT 2014


Hi Joachim,

Thanks for the answer. I suspected that it goes in this direction :).

Now, the next question. I saw that it is possible to enable callbacks, but
I could not find an example of how it works.

For example, could we model this:

- in a JavaClassOriginator class we have a method like
execute(JavaClassTargetInterface target) { target.m() }
- In Pharo we create PharoClassTargetImplementation as an implementation of
JavaClassTargetInterface
- passing an instance of PharoClassTargetImplementation to
JavaClassOriginator results in calling PharoClassTargetImplementation>>m

?


Cheers,
Doru



On Sat, Mar 29, 2014 at 11:32 AM, Joachim Geidel <
joachim.geidel at onlinehome.de> wrote:

> Hi Doru,
>
> Am 27.03.2014 um 13:07 schrieb Tudor Girba:
> > Just a question: is there a way to communicate with an already running
> VM that was started independently from Pharo?
>
> JNIPort uses the Java VM as a DLL / shared library, using the Java
> Invocation Interface which is part of the Java Native Interface. Actually,
> the Java VM *is* a shared library, and the java.exe is just a wrapper for
> starting it. When using JNIPort, the Pharo VM and the Java VM run in the
> same operating system process, and communicating with the Java VM just
> means calling functions from a library.
>
> Communicating with an already running Java VM is a totally different use
> case, as the Pharo VM and the Java VM run in two different operating system
> processes. To establish a communication between them, you would have to use
> an inter-process communication mechanism available in both of them. Pipes,
> TCP sockets, a messaging system, or running one of them as a server and the
> other as a client using a common protocol. That's not what JNIPort is made
> for, and what you need for implementing it depends on the communication
> mechanism.
>
> HTH,
> Joachim
>
>
>


-- 
www.tudorgirba.com

"Every thing has its own flow"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20140331/4853765a/attachment.html>


More information about the Pharo-users mailing list