Jump to content
Excelsior Forums

Dereferencing a double pointer to a struct

Recommended Posts


I have got a licensed copy of xFunction version 2.15 ...

I wanted to know how to dereference a double pointer to a struct.

Our C-Code has the following API -

          long Function(struct1* var1,unsigned char* var2, long var3,struct1** var4);

struct1 is a structure defined in the C-Code as -

struct struct1


unsigned char* data;

long datalen;

int typeOfData;


I have a corresponding Java Class for struct1.

My xFunction wrapper looks something like...

wrapper_Function ( Struct1_class objInput, String var2, long var3, )




      xFunction func = new xFunction(strSignerLibName,

              "long Function( com.structures.Struct1_class*, "+

              "char*, long, com.structures.Struct1_class**)");


      Argument[] args = new Argument[4];

      args[0] = Pointer.createPointerTo(objInput);

      args[1] = Argument.create("char*", var2 );

      args[2] = new Argument ( var3 );

      Pointer pOut = Pointer.create(com.structures.Struct1_class**");

      args[3] = pOut;

      int nRetVal =  ((Integer)func .invoke(args)).intValue();



      objOutputData = new Struct1_class();

      objOutputData = (Struct1_class)((Pointer) pOut.deref());

-- I know the above line of code is not right.... WHAT DO I do here now ?? How do I Derefence the Output ?     

      return nRetVal ;


    catch (com.excelsior.xFunction.xFunctionException xf)


      throw new xFunctionGenericException(xf);




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