MCPcopy Create free account
hub / github.com/PolyhedraZK/ExpanderCompilerCollection / initCompilePtr

Function initCompilePtr

ecgo/rust/wrapper/wrapper.go:157–193  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

155}
156
157func initCompilePtr() {
158 compilePtrLock.Lock()
159 defer compilePtrLock.Unlock()
160 if compilePtr != nil {
161 return
162 }
163 cacheDir, err := getCacheDir()
164 if err != nil {
165 panic(fmt.Sprintf("failed to get cache dir: %v", err))
166 }
167 soPath := filepath.Join(cacheDir, getLibName())
168 updateLib(soPath)
169 handle := C.dlopen(C.CString(soPath), C.RTLD_LAZY)
170 if handle == nil {
171 panic("failed to load libec_go_lib, you may need to install openmpi")
172 }
173 abiVersionPtr := C.dlsym(handle, C.CString("abi_version"))
174 if abiVersionPtr == nil {
175 panic("failed to load abi_version function")
176 }
177 abiVersion := C.abi_version(abiVersionPtr)
178 if abiVersion != ABI_VERSION {
179 panic("abi_version mismatch, please consider update the go package")
180 }
181 compilePtr = C.dlsym(handle, C.CString("compile"))
182 if compilePtr == nil {
183 panic("failed to load compile function")
184 }
185 proveCircuitFilePtr = C.dlsym(handle, C.CString("prove_circuit_file"))
186 if proveCircuitFilePtr == nil {
187 panic("failed to load prove_circuit_file function")
188 }
189 verifyCircuitFilePtr = C.dlsym(handle, C.CString("verify_circuit_file"))
190 if verifyCircuitFilePtr == nil {
191 panic("failed to load verify_circuit_file function")
192 }
193}
194
195// from c to go
196func goBytes(data *C.uint8_t, length C.uint64_t) []byte {

Callers 3

CompileWithRustLibFunction · 0.85
ProveCircuitFileFunction · 0.85
VerifyCircuitFileFunction · 0.85

Calls 3

getCacheDirFunction · 0.85
getLibNameFunction · 0.85
updateLibFunction · 0.85

Tested by

no test coverage detected