Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4b4211e

Browse files
committedJul 7, 2024·
bindings/go/blst.tgo: add SrcRoot variable to hold the source code root.
1 parent fa1788b commit 4b4211e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎bindings/go/blst.go

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package blst
1616
// #cgo loong64 mips64 mips64le ppc64 ppc64le riscv64 s390x CFLAGS: -D__BLST_NO_ASM__
1717
//
1818
// #include "blst.h"
19+
// const char *go_blst_src_server_c();
1920
//
2021
// #if defined(__x86_64__) && (defined(__unix__) || defined(__APPLE__))
2122
// # include <signal.h>
@@ -156,6 +157,7 @@ import "C"
156157
import (
157158
"fmt"
158159
"math/bits"
160+
"path/filepath"
159161
"runtime"
160162
"sync"
161163
"sync/atomic"
@@ -217,6 +219,13 @@ var cgo_p1Generator = *C.blst_p1_generator()
217219
var cgo_p2Generator = *C.blst_p2_generator()
218220
var cgo_fp12One = *C.blst_fp12_one()
219221

222+
var SrcRoot = initSrcRoot()
223+
224+
func initSrcRoot() string {
225+
path := C.GoString(C.go_blst_src_server_c())
226+
return filepath.Dir(filepath.Dir(path))
227+
}
228+
220229
// Secret key
221230
func (sk *SecretKey) Zeroize() {
222231
var zero SecretKey

‎bindings/go/blst.tgo

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ package blst
1212
// #cgo loong64 mips64 mips64le ppc64 ppc64le riscv64 s390x CFLAGS: -D__BLST_NO_ASM__
1313
//
1414
// #include "blst.h"
15+
// const char *go_blst_src_server_c();
1516
//
1617
// #if defined(__x86_64__) && (defined(__unix__) || defined(__APPLE__))
1718
// # include <signal.h>
@@ -207,6 +208,13 @@ var cgo_p1Generator = *C.blst_p1_generator()
207208
var cgo_p2Generator = *C.blst_p2_generator()
208209
var cgo_fp12One = *C.blst_fp12_one()
209210

211+
var SrcRoot = initSrcRoot()
212+
213+
func initSrcRoot() string {
214+
path := C.GoString(C.go_blst_src_server_c())
215+
return filepath.Dir(filepath.Dir(path))
216+
}
217+
210218
//
211219
// Secret key
212220
//

0 commit comments

Comments
 (0)