title: Call DLL from Java using JNA
body: <p>I am new to accessing DLLs from Java using JNA. I need to access methods from a class within a DLL(written in .net). Form this sample DLL below, I am trying to get AuditID and Server ID. I am ending with the following error while I am running my code. Any guidance really appreciated.</p>
  
  <p>/// Error ///</p>
  
  <pre><code> Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function  'GetEnrollcontext': The specified procedure could not be found.
  </code></pre>
  
  <p>//DLL File Code//</p>
  
  <pre><code>SampleDLL.ProfileEnroll enrollcontext = new SampleDLL.ProfileEnroll();
  enrollcontext.Url =” url”;
  enrollcontext.AuditIdType = SampleDLL.ProfileId;
  enrollcontext.AuditId = “22222222 “; 
  enrollcontext.ServerId = “server1”;
  </code></pre>
  
  <p>/// Java Code ///</p>
  
  <pre><code>import com.sun.jna.Library;
  import com.sun.jna.Native;
  import com.sun.jna.Structure;
  import dllExtract.DLLExtractTest.SampleDLL.Enrollcontext;
  
  
  public class SampleDLLExtract {
  
      public interface SampleDLL extends Library {
          SampleDLL INSTANCE = (SampleDLL) Native.loadLibrary("SampleDLL",
              SampleDLL.class);
  
          public static class Enrollcontext extends Structure { 
  
              public String auditId;
              public String serverId;
          }
              void GetEnrollcontext(Enrollcontext ec);                     // void ();
      }
      public static void main(String[] args) {
          SampleDLL sdll = SampleDLL.INSTANCE;
          SampleDLL.Enrollcontext enrollContext = new SampleDLL.Enrollcontext();
          sdll.GetEnrollcontext(enrollContext);
  
          System.out.println(sdll.toString(sdll.GetEnrollcontext(enrollContext))); 
      }
  }
  </code></pre>