[squeak-dev] JNIPort preview for Squeak and Pharo available on SqueakSource

Joachim Geidel joachim.geidel at onlinehome.de
Wed Jun 9 19:20:53 UTC 2010

Am 09.06.10 20:49 schrieb Eliot Miranda:
>> As far as I know, Alien does not yet accept paths to a library from
>> Smalltalk.
> I don't understand this. Of course Alien accepts paths to libraries from
> Smalltalk.  Look at Alien class>>primLoadLibrary:, which is wrapped by Alien
> class>>lookup: symbol inLibrary: libraryName.

Apparently I have thoroughly misunderstood something, probably from one of
the threads about having to place a symbolic link to the library in the VM's
resources directory on Mac OS X 10.6. Thanks for the correction!

>>  I have not used it on Windows, so I don't know what has to be
>> done there. The jvm.dll is typically located at
>>   C:\Program Files\Java\jre1.6.0_NN\bin\client\jvm.dll
>> where NN is the patch level of the JRE.
> So you do something like
> entrypoint := Alien lookup: theJREentrypoint inLibrary: 'C:\Program
> Files\Java\jre1.6.0_NN\bin\client\jvm.dll' 
> and call through that.  Look at Alien class examples.

For JNIPort, the library file name can be configured before loading the
library, so this should actually be easy:

| jvmSettings jvm zfClass zipfile entries |
    libraryFile: 'C:\Program Files\Java\jre1.6.0_16\bin\client\jvm.dll'.
jvmSettings := JVMSettings new.
jvmSettings usesGhosts: true.
jvmSettings jniPortSettings useJNIHelperLibrary: false.
jvmSettings runtimeSettings
    classpath: '.;C:\somepath\JNIPort.jar;C:\somepath\JNIPort-Tests.jar'.
Cursor execute showWhile: [JVM newWithSettings: jvmSettings].

Best regards,
Joachim Geidel

More information about the Squeak-dev mailing list