Hi Muriel,
>I work in VisualWorks and I use JNIPort to interact with Java.
>I try to search a forum about this subject but I don't find, so I
>contact you because I can see all my java Object but I want to do
>callback on Smalltalk
>object.
In VisualWorks, JNIPort supports callbacks from Java to Smalltalk,
including callbacks coming from another operating system thread (a
"foreign thread"). However, it is relatively complicated to install a
callback.
The complication comes from the fact that JNIPort was originally developed
for Dolphin Smalltalk, where the handling of callbacks from external
libraries is such that it can easily lead to deadlocks in Smalltalk.
VisualWorks implements callbacks from external libraries differently, and
some of the complications could probably be dismissed. Unfortunately, I
never had the time to simplify the current implementation of callbacks in
JNIPort for VisualWorks.
There is some documentation about using callbacks in the JNIPort
documentation which is contained in the file attachment JNIPort_Docs.zip
of the JNIPort bundle. You can read this only at Chris Uppal's web site:
http://www.metagnostic.org/DolphinSmalltalk/JNIPort/callbacks.html
http://www.metagnostic.org/DolphinSmalltalk/JNIPort/callback-example-1.htmlDon't take the hints to the "problem with threads" in the documentation
too seriously, they apply to Dolphin Smalltalk only AFAICT. The source
code of the examples is in the file attachment JNIPort_Extras.zip of the
JNIPort bundle. It is in the archive JNIPort-Tests.zip, file
TreeModelExample.java.
If you don't have the file attachments of the JNIPort bundle, you can
either download them from the Download page of the JNIPort wiki at
http://jniport.wikispaces.com, or load the bundle from the Cincom Public
Repository. They should also be in the contributed/JNIPort subdirectory of
the VisualWorks installation.
HTH,
Joachim