Skip to main content

A problem with XFunction

No replies
yarab
Offline
Joined: 2006-11-14
Points: 0

I wrote the following program in C++ 6.0:-

#include

typedef struct{
int arr[8];
} MY_STRUCT;

__declspec(dllexport) void display_values(MY_STRUCT *my){

int i;

for(i=0;i<8;i++){
int val= my->arr[i];
printf("%d ", val);
printf("\n");
}
}

And I saved this code in a .c file and the project was built successfully and I put the resulting DLL in system32 folder.

Then I made a program in NetBeans 5.0 as follows:-

import com.excelsior.xFunction.*;
public class Main {

public Main() {
}
public static void main(String[] args) throws xFunctionException{
xFunction f=new xFunction("mydll","void display_values(int *)");
int[] arr={1,2,3,4,5,6,7,8};
MY_STRUCT my = new MY_STRUCT();
my.arr=arr;
Pointer arg = Pointer.createPointerTo(my);
f.invoke(arg);
System.out.println("\nOK");
}

}
class MY_STRUCT extends Structure{

int[] arr;

public String defineLayout(){
return "int[8] arr";
}

public MY_STRUCT(){
arr = new int[8];
}
}
then there was an error says:-

com.excelsior.xFunction.IllegalSignatureException: Class 'MY_STRUCT' not found

at com.excelsior.xFunction.ArgType.(ArgType.java:169)

at com.excelsior.xFunction.ArgType.getArgType(ArgType.java:110)

at com.excelsior.xFunction.xFunction.parseSignature(xFunction.java:222)

at com.excelsior.xFunction.xFunction.(xFunction.java:41)

So please some one help me.