var v:fn v.p= test echo v.p(2,3) echo v.p #How to get this value?
Well, v.p will get you the value. However, v.p is a closure type, which cannot really be printed using echo (internally, it's a pair containing a pointer to the function and a pointer to the environment).
If you want to just look at the address of the function inside (say, for debugging purposes), the following should work:
proc test(a: int, b: int): int =
result = a+b
type
fn = object
p: proc (x: int, y: int): int {.nimcall.}
var v: fn
v.p = test
echo v.p(2, 3)
echo cast[uint](v.p)
echo cast[uint](test)