java - How to simulate objectpointers -


i hava facade object dll cant modify using jna. dll keeps internal states , should same instance. facade object keeps state aswell.

if understand correctly, if change non-primitive of object, change not traverse caller since internal pointer non-primitive might have changed.

is there better way passing around wrapperobject keep changes? eg.:

public class facade  {     private final dll dll;     public facade(int foo, int bar)     {         //init facade         this.dll = new dll();     }     int foo(int bar)     {}     // more methods }  public class wrapper {     public final facade facade;      public wrapper(facade facade)     {         this.facade = facade;     } }  public static class app {     public static int main(string[] args)     {         facade fac = new facade(0,0);         wrapper pointersim = new wrapper(fac);          methoda(pointersim);         methodb(pointersim);     } } 

with goal of pointersim reflecting changes after methoda , b member classes , byte arrays.

or pretense false?

you can pass around native objects using simple pointer. class has number of accessor methods read offsets memory base pointer.

if want type safety around specific class of pointers, can make own pointer type with

public class facade extends pointertype {      public facade() { }     public facade(pointer p) { } } 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -