Jump to content
Excelsior Forums
Sign in to follow this  
ragerino

not able to pass 2nd argument correctly

Recommended Posts

hi all

i'm trying to execute following api-call

Definition: "long IFconnect(string userid, string password);"

so i coded following lines (after some tries):

public class ifAnmeldung {
     public static void main(String[] args) {
           try{
                 xFunction f=null;
                 Argument arg1=null;
                 Argument arg2=null;
                 Object o=null;
                 String rueck=null;

                              //IFConnect
                             f=new xFunction("6020API.dll", "int IFconnect(CSTRING,CSTRING)");
                             arg1 = new Argument("userid", Argument.CSTRING);
                             arg2 = new Argument("pwd", Argument.CSTRING);
                             o=new Object();
                             o=f.invoke(arg1,arg2);
                             System.out.println("arg1:" + (String)arg1.getValue());
                             System.out.println("arg2:" + (String)arg2.getValue());
                             rueck=o.toString();
                             System.out.println(o.getClass());
                             System.out.println("IFconnect(CSTRING,CSTRING)=" + rueck);

                             //IFerrno
                             f=new xFunction("6020API.dll","int IFerrno ()");
                             o=new Object();
                             o=f.invoke();
                             rueck=o.toString();
                             System.out.println(o.getClass());
                             System.out.println("IFerrno ()=" + rueck); 
           }catch(Exception e){
                 System.out.println("Error:" + e.toString());
           }
     }
}

IFerrno allwas displays me errorcode 312 (wrong password) when using correct user and correct password, and errorcode 311(wrong user) when using wrong user and correct password.

so it seems to me, that the passing through of the 2nd argument (arg2) is not correct. has anyone experienced the same problems, or has anyone a solution.

thanx in advance,

ragerino

Share this post


Link to post
Share on other sites

Hi,

The only reason I can suppose is that the type 'string' used is not standard null-terminated C string.

If you're familiar with the C language, please try to invoke the same function from the C code. (something like the following code)

__stdcall int IFconnect(char*, char*);
__stdcall int IFerrno(void);
void main() {
  IFconnect("userid", "pwd");
  printf("%d\n", IFerrno());
}

It may help to determine whether the problem is in the xFunction implementation or in the 6020API.dll misuse.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×