pointers - Prevent object from being moved by garbage collector in F# -


in c# es easy pin object place stored using keyword "fixed". here example msdn:

unsafe static void testmethod() {      // assume class point { public int x, y; }     // pt managed variable, subject garbage collection.     point pt = new point();      // using fixed allows address of pt members     // taken, , "pins" pt isn't relocated.      fixed (int* p = &pt.x)     {         *p = 1;     }          } 

how can done in f#?

you can use gchandle type pinned


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -