c# - JNA couldn't find the specified procedure in dll file through java -


i trying access dll procedure through java java method unable find procedure. dll file loaded the procedure c# code named login can't call.

below def of procedure in adhelper.dll:

 public static adhelper.loginresult login(string username, string password)     {       if (!adhelper.isuservalid(username, password))         return adhelper.loginresult.login_user_doesnt_exist;       directoryentry user = adhelper.getuser(username);       if (user == null)         return adhelper.loginresult.login_user_doesnt_exist;       int useraccountcontrol = convert.toint32(runtimehelpers.getobjectvalue(user.properties["useraccountcontrol"][0]));       user.close();       return !adhelper.isaccountactive(useraccountcontrol) ? adhelper.loginresult.login_user_account_inactive : adhelper.loginresult.login_ok;     } 

the dll file name adhelper.dll. loginresult enum type:

public enum loginresult     {       login_ok,       login_user_doesnt_exist,       login_user_account_inactive,     } 

below java program call procedure:

package dlltest;  import com.sun.jna.*;  public class dlltester {              public interface adhelper extends library {                   public final int login_ok=1;              public final int login_user_doesnt_exist=2;              public final int login_user_account_inactive=3;                  public int login(string user, string pass);            }            public static void main(string[] args) {               adhelper objadh = (adhelper) native.loadlibrary("adhelper", adhelper.class);             system.out.println(objadh.getclass().getdeclaredmethods());              objadh.login("ashish", "asdas");              }  } 

now, gives following error:

exception in thread "main" java.lang.unsatisfiedlinkerror: error looking function 'login': specified procedure not found.

do tell me if more details needed.

the solution based upon methodolgy:

enums/constants handling in java dll.

note: have included dll file in system32 testing purpose, easy access too. dll file loading login function not calling.

the output of sop line in java :

[ljava.lang.reflect.method;@145d068 

the problem here dll .net dll, not native dll. jna loads , understands native dlls, is, dlls built function outside .net framework.

what means need different glue between java , .net. have worked jni4net , ikvm, , there few others, might want @ those.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -