From 871d693726cac05a45ea0a8ebc2702e6b2c66712 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 27 Aug 2025 01:03:09 -0400 Subject: [PATCH] use C.int64_t and C.uint64_t instead of C.long and C.ulong I tried to build tests for a go project with a go-dcgm dependency on a macbook, and it failed to compile with errors like: cannot use _Ctype_long(ts) (value of int64 type _Ctype_long) as _Ctype_int64_t value in struct literal This patch fixes the errors by making the width explicitly defined, which better matches the header file definitions. Signed-off-by: Anthony Romano --- pkg/dcgm/internal.go | 2 +- pkg/dcgm/policy.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/dcgm/internal.go b/pkg/dcgm/internal.go index b6e1033..cfe8172 100644 --- a/pkg/dcgm/internal.go +++ b/pkg/dcgm/internal.go @@ -100,7 +100,7 @@ func InjectFieldValue(gpu uint, fieldID Short, fieldType uint, status int, ts in fieldId: C.ushort(fieldID), fieldType: C.ushort(fieldType), status: C.int(status), - ts: C.long(ts), + ts: C.int64_t(ts), } switch fieldType { diff --git a/pkg/dcgm/policy.go b/pkg/dcgm/policy.go index 466481a..019829c 100644 --- a/pkg/dcgm/policy.go +++ b/pkg/dcgm/policy.go @@ -366,7 +366,7 @@ func registerPolicy(ctx context.Context, groupID GroupHandle, typ ...policyCondi return nil, err } - result := C.dcgmPolicyRegister_v2(handle.handle, groupID.handle, condition, C.fpRecvUpdates(C.violationNotify), C.ulong(0)) + result := C.dcgmPolicyRegister_v2(handle.handle, groupID.handle, condition, C.fpRecvUpdates(C.violationNotify), C.uint64_t(0)) if err = errorString(result); err != nil { return nil, &Error{msg: C.GoString(C.errorString(result)), Code: result}