mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-18 10:39:05 +02:00
headers: fail Build on missing native exports and assert MI/COM layouts (#2739)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
|
||||
"github.com/prometheus-community/windows_exporter/internal/headers/lazyproc"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
@@ -36,8 +37,22 @@ var (
|
||||
procHcsOpenComputeSystem = modComputeCore.NewProc("HcsOpenComputeSystem")
|
||||
procHcsGetComputeSystemProperties = modComputeCore.NewProc("HcsGetComputeSystemProperties")
|
||||
procHcsCloseComputeSystem = modComputeCore.NewProc("HcsCloseComputeSystem")
|
||||
|
||||
load = lazyproc.Once(modComputeCore,
|
||||
procHcsCreateOperation,
|
||||
procHcsWaitForOperationResult,
|
||||
procHcsCloseOperation,
|
||||
procHcsEnumerateComputeSystems,
|
||||
procHcsOpenComputeSystem,
|
||||
procHcsGetComputeSystemProperties,
|
||||
procHcsCloseComputeSystem,
|
||||
)
|
||||
)
|
||||
|
||||
// Load checks that computecore.dll exports every function of this package.
|
||||
// Call it in Build: a missing export panics on the first call otherwise.
|
||||
func Load() error { return load() }
|
||||
|
||||
// CreateOperation creates a new operation.
|
||||
//
|
||||
// HcsCreateOperation returns the operation handle, or NULL on failure.
|
||||
|
||||
Reference in New Issue
Block a user