Register registers a new variable instance.
(typnm string, ifc interface{})
| 107 | |
| 108 | // Register registers a new variable instance. |
| 109 | func Register(typnm string, ifc interface{}) CGoHandle { |
| 110 | if IfaceIsNil(ifc) { |
| 111 | return -1 |
| 112 | } |
| 113 | mu.Lock() |
| 114 | defer mu.Unlock() |
| 115 | if handles == nil { |
| 116 | handles = make(map[GoHandle]interface{}) |
| 117 | counts = make(map[GoHandle]int64) |
| 118 | } |
| 119 | ctr++ |
| 120 | hc := ctr |
| 121 | ghc := GoHandle(hc) |
| 122 | handles[ghc] = ifc |
| 123 | counts[ghc] = 0 |
| 124 | if trace { |
| 125 | fmt.Printf("gopy Registered: %s %v %d\n", typnm, ifc, hc) |
| 126 | } |
| 127 | return CGoHandle(hc) |
| 128 | } |
| 129 | |
| 130 | // DecRef decrements the reference count for the specified handle |
| 131 | // and removes it if the reference count goes to zero. |
nothing calls this directly
no test coverage detected