Hi again,

I continued with experimentation in Pharo 3. Specifically, I would like to
get a callback working, but something does not work out.

Could you take a look below? Perhaps you can spot what I am doing wrong.

Here is what I did:

1. I downloaded:
https://sites.google.com/site/jniport/file-cabinet/JNIPort30_Extras.zip

2. I created the following Java class:

package com.tudorgirba.jniport.callback;

import jniport.RequestNotHandedException;

import jniport.SmalltalkNotification;

public class SimpleNotifier {

private static final Object   notifyTag = new String("sendNotification()");

public static Object notifyTag () { return notifyTag; }

public void sendNotification() throws RequestNotHandedException

{

new SmalltalkNotification(notifyTag, this).send();

}

}

3. Then I ran this code in a Pharo 3.0 image:

"---"
Gofer new
smalltalkhubUser: 'JNIPort' project: 'JNIPort';
configuration;
loadVersion: '3.0-baseline'.

JNIPortJNIInterface libraryFile:
'/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libclient.dylib'.
jvmSettings := JVMSettings new.
jvmSettings usesGhosts: true.
jvmSettings supportsCallbacks: true.
jvmSettings jniPortSettings  useJNIHelperLibrary: false.
jvmSettings ghostClassSettings retainMethodSource: true.
jvmSettings runtimeSettings classpath:
'.:/Users/girba/Work/Code/moose/JNIPort30.jar:/Users/girba/Work/Code/moose/JNIPort30-Tests.jar:/Users/girba/Work/Code/moose/jniport/jniport-callbacks/bin/'.
Cursor execute showWhile: [JVM newWithSettings: jvmSettings].
notifierClass := JVM current findClass:
#'com.tudorgirba.jniport.callback.SimpleNotifier'.
JVM current callbackRegistry
        setCallback: notifierClass notifyTag
        handler: [:this :param | *self halt*].
notifier := notifierClass new.
notifier *sendNotification*.
"---"

Everything executes without error, but the *self halt* part is not reached.
I would expect that when the #sendNotification is executed, the
corresponding handler gets executed and the debugger appears.
(I thought that perhaps something is wrong with the classpath, but the
notifierClass and the notifier objects look just fine)

Any idea of what is wrong?

Cheers,
Doru




On Wed, Jul 29, 2015 at 10:47 AM, Tudor Girba <tu...@tudorgirba.com> wrote:

> Hi Joachim,
>
> Thanks for the answer.
>
> Unfortunately, I am stuck at the moment too, and I have no idea how to
> proceed. I would really benefit from your, or someone else's, help :).
>
> Cheers,
> Doru
>
>
> On Tue, Jul 28, 2015 at 9:57 PM, Joachim Geidel <
> joachim.gei...@onlinehome.de> wrote:
>
>> Hi Tudor,
>>
>> unfortunately I haven’t had much time to work on JNIPort for a while. I
>> have started to simplify some of the code, but this isn’t finished yet, and
>> I have not yet looked into Pharo 4 and 5. The latest Pharo version I have
>> worked with was 3, because I was waiting for the VM and NativeBoost changes
>> which were announced but not finished the last time I looked (which is a
>> long time ago). So currently, I can’t tell what is wrong. Obviously,
>> something has changed in the class building mechanism since Pharo 3. The
>> other problem might be related to NativeBoost or the VM, but of course I am
>> speculating for now.
>>
>> Cheers,
>> Joachim
>>
>> Am 28.07.2015 um 16:10 schrieb Tudor Girba-2 [via Smalltalk] <[hidden
>> email] <http:///user/SendEmail.jtp?type=node&node=4839859&i=0>>:
>>
>> Hi Joachim,
>>
>> Thanks for the answer.
>>
>> I did not have Java 1.6 anymore on my Yosemite, but I installed it now.
>> For reference, here is how to get it:
>> https://support.apple.com/kb/DL1572?locale=en_US
>>
>> I still have problems in Pharo5.
>>
>> I am trying the following script:
>> http://ws.stfx.eu/CHS8KCAGWGO2
>>
>> I tried in Pharo 3, and the script worked fine.
>>
>> I also tried with Pharo4 and Pharo5, but it does not work because I get a
>> MNU for GhostClassBuilder>>#client:.
>>
>> I fixed it in a Pharo5 image by using #installer: instead, but the
>> computation of "JVM newWithSettings: jvmSettings" does not seem to finish
>> and it blocks the VM.
>>
>> Any idea of what goes wrong?
>>
>> Cheers,
>> Tudor
>>
>>
>>
>> ------------------------------
>> View this message in context: Re: troubles with JNIPort on Pharo 5 /
>> Java 8
>> <http://forum.world.st/troubles-with-JNIPort-on-Pharo-5-Java-8-tp4836922p4839859.html>
>> Sent from the Pharo Smalltalk Users mailing list archive
>> <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at
>> Nabble.com.
>>
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"
>



-- 
www.tudorgirba.com

"Every thing has its own flow"

Reply via email to