Note that there are some explanatory texts on larger screens.

plurals
  1. POJNA loading libraries
    text
    copied!<p>I've got two libraries, one with Ada objects and one with C++ objects (I don't have a lot of control about which goes where)</p> <p>The Ada stuff references the C stuff and vice versa...</p> <p>This symbol is in libIPCAda.so: <strong>ipc_manager_shutdown_c</strong></p> <p>This symbol is in libIPCC.so: <strong>stream_buffer_header_size</strong></p> <p>When I do these JNA Calls:</p> <pre><code> CLibrary INSTANCE8 = (CLibrary) Native.loadLibrary("IPCAda", // &lt;&lt;&lt; our library goes here CLibrary.class); CLibrary INSTANCE9 = (CLibrary) Native.loadLibrary("IPCC", // &lt;&lt;&lt; our library goes here CLibrary.class); </code></pre> <p>I get this:</p> <pre><code>ld.so.1: java: fatal: relocation error: file &lt;&lt;my directory&gt;&gt;/lib/libIPCAda.so: symbol stream_buffer_header_size: referenced symbol not found </code></pre> <p>When I do these JNA calls:</p> <pre><code> CLibrary INSTANCE9 = (CLibrary) Native.loadLibrary("IPCC", // &lt;&lt;&lt; our library goes here CLibrary.class); CLibrary INSTANCE8 = (CLibrary) Native.loadLibrary("IPCAda", // &lt;&lt;&lt; our library goes here CLibrary.class); </code></pre> <p>I get this:</p> <pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'IPCC': ld.so.1: java: fatal: relocation error: file &lt;&lt;my directory&gt;&gt;/lib/libIPCC.so: symbol ipc_manager_shutdown_c: referenced symbol not found at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:163) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:236) at com.sun.jna.Library$Handler.&lt;init&gt;(Library.java:140) at com.sun.jna.Native.loadLibrary(Native.java:379) at com.sun.jna.Native.loadLibrary(Native.java:364) at Test2$CLibrary.&lt;clinit&gt;(Test2.java:55) at Test2.main(Test2.java:74) </code></pre> <p>Obviously its not liking the cross dependent symbols... Is there any way to make this work in JNA?</p> <p>*<strong><em>EDIT Example Compile *</em></strong></p> <pre><code>gcc -c -fPIC -g -O0 -fstack-check -pipe -gnatE -gnatU -gnatwl -gnatf -gnatE -gnat05 -lIPCC -I- -gnatA &lt;&lt;my directory&gt;&gt;src/ndds_c.adb </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload