Jump to content
Excelsior Forums
Sign in to follow this  
fuse

Tutorial Example won't run

Recommended Posts

Hello,

I'm currently evaluating xFunction but I have a nasty problem.

Examine this code take from the helpfiles

import com.excelsior.xFunction.*;

public class t 
{

 public class Point extends Structure {
       int x;
       int y;
       public String defineLayout(){return "int x, int y";}
 }

 public t(){
   try {
     xFunction f=new xFunction("somedll",
                               "int* _func@8(int*, Point*)");
     Point p=new Point();  p.x=10; p.y=20;
     Pointer arg1= Pointer.create("int*");
     Pointer arg2=Pointer.createPointerTo(p);
     Pointer result=(Pointer)(f.invoke(arg1,arg2));
     if(((Integer)arg1.deref()).intValue()!=2)
         throw new Error();
     p=(Point)arg2.deref();
     if(p.x!=1) throw new Error();
   } catch(Exception e){
     e.printStackTrace();
   }
 }
 public static void main(String[] args) {
   t test = new t();
   System.exit(0);
 }
 
}

This results in:

com.excelsior.xFunction.IllegalSignatureException: Class 'Point' not found
at com.excelsior.xFunction.ArgType.<init>(ArgType.java:174)
at com.excelsior.xFunction.ArgType.getArgType(ArgType.java:113)
at com.excelsior.xFunction.xFunction.parseSignature(xFunction.java:181)
at com.excelsior.xFunction.xFunction.<init>(xFunction.java:30)
at t.<init>(t.java:16)
at t.main(t.java:31)

What about the parsing of the signature and defined structures?

Share this post


Link to post
Share on other sites

Me bad.

If you put the class file in a package you need to include the packagename in the construction.

eg. Pointer p = new Pointer.create("mypackage.Point");

Pherhaps this could be mentioned more stricly in the documentation. ;)

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  

×