<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [Java JNI] Loading a shared image in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511486#M32011</link>
    <description>Bernhard,&lt;BR /&gt;&lt;BR /&gt;I have not needed to do things in this particular way (yet), but the following should work.&lt;BR /&gt;&lt;BR /&gt;To the best of my knowledge, there is no restriction on the number of native mode libraries that you can connect to. I would thus do what you are attempting in the following way:&lt;BR /&gt;- Loan a basic JNI library which allows you to define/redefine a logical name in the process logical name table.&lt;BR /&gt;- Use that basic library to define the logical name.&lt;BR /&gt;- Then issue the loadLibrary function.&lt;BR /&gt;&lt;BR /&gt;Since, as we noted earlier, unload is a whole different story, I would be careful to make sure that the quotas were sufficient, otherwise you will effectively be creating a situation with much the same virtual address behavior as a "memory leak".&lt;BR /&gt;&lt;BR /&gt;I hope that the preceeding is helpful.&lt;BR /&gt;&lt;BR /&gt;- Bob Gezelter, &lt;A href="http://www.rlgsc.com" target="_blank"&gt;http://www.rlgsc.com&lt;/A&gt;</description>
    <pubDate>Sat, 26 Mar 2005 07:16:15 GMT</pubDate>
    <dc:creator>Robert Gezelter</dc:creator>
    <dc:date>2005-03-26T07:16:15Z</dc:date>
    <item>
      <title>[Java JNI] Loading a shared image</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511483#M32008</link>
      <description>Hi!&lt;BR /&gt;&lt;BR /&gt;I am using Java 1.4.2 under OpenVMS 7.3.1 with ODS-5.&lt;BR /&gt;&lt;BR /&gt;From our application, which is highly dynamic and plugin oriented, we load and unload Java components at runtime. Sometimes we have to integrate legacy code, which is done via JNI.&lt;BR /&gt;The problem is, that loading the SHRs the way HP suggests in their JNI example is not applicable for us, since this would require us to define a symbol for each installed library (and drop it when the component is uninstalled).&lt;BR /&gt;&lt;BR /&gt;Java.lang.System provides two methods to load native code:&lt;BR /&gt;System.loadLibrary(String libname) --&amp;gt; this one requires a defined symbol&lt;BR /&gt;System.load(String path) --&amp;gt; takes an absolute path to the SHR.&lt;BR /&gt;&lt;BR /&gt;Can anyone tell me which path syntax is expected by System.load?&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Mar 2005 14:46:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511483#M32008</guid>
      <dc:creator>Bernhard Dorninger</dc:creator>
      <dc:date>2005-03-24T14:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: [Java JNI] Loading a shared image</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511484#M32009</link>
      <description>Bernhard,&lt;BR /&gt;&lt;BR /&gt;Perhaps I am mis-understanding some element of your problem description, but System.loadLibrary does not require a "symbol". The -libmame- parameter is used as a logical name (not a symbol).&lt;BR /&gt;&lt;BR /&gt;Unloading dynamically loaded code is a whole different topic, and has complications (which I would expect, on first glance, to have other, deeper issues). &lt;BR /&gt;&lt;BR /&gt;I have used this interface successfully. It does obey the logical name (for the native code; java code still needs to be on CLASSPATH).&lt;BR /&gt;&lt;BR /&gt;Defining the logical name to point to different places from within java code should not be a problem (with the appropriate auxilliary code to invoke the system services to define/redefine the logical name).&lt;BR /&gt;&lt;BR /&gt;I hope that the above is helpful.&lt;BR /&gt;&lt;BR /&gt;- Bob Gezelter, &lt;A href="http://www.rlgsc.com" target="_blank"&gt;http://www.rlgsc.com&lt;/A&gt;</description>
      <pubDate>Fri, 25 Mar 2005 06:43:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511484#M32009</guid>
      <dc:creator>Robert Gezelter</dc:creator>
      <dc:date>2005-03-25T06:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: [Java JNI] Loading a shared image</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511485#M32010</link>
      <description>Thanks, Robert.&lt;BR /&gt;&lt;BR /&gt;Do you have any hints where to find code that allows the use of OpenVMS commands from within java?&lt;BR /&gt;I think that Runtime.exec(..) won't do, because this call spawns another process.&lt;BR /&gt;&lt;BR /&gt;And, of course UNloading the native code is really a different issue and it's not supported by the Java API at all.&lt;BR /&gt;&lt;BR /&gt;However, i still try to get System.load(pathname) to work, since this would render a logical name unnecessary (so I hope at least..)&lt;BR /&gt;Can't test this before Tuesday, since I have no access to an OpenVMS machine from home....&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Bernhard</description>
      <pubDate>Sat, 26 Mar 2005 03:06:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511485#M32010</guid>
      <dc:creator>Bernhard Dorninger</dc:creator>
      <dc:date>2005-03-26T03:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: [Java JNI] Loading a shared image</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511486#M32011</link>
      <description>Bernhard,&lt;BR /&gt;&lt;BR /&gt;I have not needed to do things in this particular way (yet), but the following should work.&lt;BR /&gt;&lt;BR /&gt;To the best of my knowledge, there is no restriction on the number of native mode libraries that you can connect to. I would thus do what you are attempting in the following way:&lt;BR /&gt;- Loan a basic JNI library which allows you to define/redefine a logical name in the process logical name table.&lt;BR /&gt;- Use that basic library to define the logical name.&lt;BR /&gt;- Then issue the loadLibrary function.&lt;BR /&gt;&lt;BR /&gt;Since, as we noted earlier, unload is a whole different story, I would be careful to make sure that the quotas were sufficient, otherwise you will effectively be creating a situation with much the same virtual address behavior as a "memory leak".&lt;BR /&gt;&lt;BR /&gt;I hope that the preceeding is helpful.&lt;BR /&gt;&lt;BR /&gt;- Bob Gezelter, &lt;A href="http://www.rlgsc.com" target="_blank"&gt;http://www.rlgsc.com&lt;/A&gt;</description>
      <pubDate>Sat, 26 Mar 2005 07:16:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511486#M32011</guid>
      <dc:creator>Robert Gezelter</dc:creator>
      <dc:date>2005-03-26T07:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: [Java JNI] Loading a shared image</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511487#M32012</link>
      <description>Bernhard,&lt;BR /&gt;&lt;BR /&gt;A little hint abbout shared images loaded in run time. I am not shure but the shared images are probably loaded using the LIB$FIND_IMAGE_SYMBOL run time library function.&lt;BR /&gt;&lt;BR /&gt;When using LIB$FIND_IMAGE_SYMBOL you must have different image names/ logical names which points to different images. If you define the same logical name to two different images the function will not load the second image.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;You have two shareable images with the same function:&lt;BR /&gt;&lt;BR /&gt;void shrfunc () {printf ("Image A\n");}&lt;BR /&gt;&lt;BR /&gt;and&lt;BR /&gt;&lt;BR /&gt;void shrfunc () {printf ("Image B\n");}&lt;BR /&gt;&lt;BR /&gt;(both linked /share with SYMBOL_VECTOR=(shrfunc=PROCEDURE) option)&lt;BR /&gt;&lt;BR /&gt;Now the main program which loads and execute both image functions:&lt;BR /&gt;&lt;BR /&gt;$DESCRIPTOR (logical_name , "MYSHAREIMAGE");&lt;BR /&gt;$DESCRIPTOR (procedure_name , "SHRFUNC");&lt;BR /&gt;$DESCRIPTOR (imagea , "dev:[dir]imagea.exe");&lt;BR /&gt;$DESCRIPTOR (imageb , "dev:[dir]imageb.exe");&lt;BR /&gt;void (*procedure) ();&lt;BR /&gt;&lt;BR /&gt;lib$set_logical (&amp;amp;logical_name , &amp;amp;imagea);&lt;BR /&gt;lib$find_image_symbol (&amp;amp;logical_name , &amp;amp;procedure_name , &amp;amp;procedure);&lt;BR /&gt;(*procedure)();&lt;BR /&gt;&lt;BR /&gt;lib$set_logical (&amp;amp;logical_name , &amp;amp;imageb);&lt;BR /&gt;lib$find_image_symbol (&amp;amp;logical_name , &amp;amp;procedure_name , &amp;amp;procedure);&lt;BR /&gt;(*procedure)();&lt;BR /&gt;&lt;BR /&gt;Now the result (output) is&lt;BR /&gt;&lt;BR /&gt;Image A&lt;BR /&gt;Image A&lt;BR /&gt;&lt;BR /&gt;and not&lt;BR /&gt;&lt;BR /&gt;Image A&lt;BR /&gt;Image B&lt;BR /&gt;&lt;BR /&gt;what is supposed to be the result!&lt;BR /&gt;&lt;BR /&gt;So when you define the logical name, give to each image a different name.&lt;BR /&gt;&lt;BR /&gt;Bojan</description>
      <pubDate>Mon, 28 Mar 2005 04:48:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-jni-loading-a-shared-image/m-p/3511487#M32012</guid>
      <dc:creator>Bojan Nemec</dc:creator>
      <dc:date>2005-03-28T04:48:12Z</dc:date>
    </item>
  </channel>
</rss>

