We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c580aab commit ddbbce4Copy full SHA for ddbbce4
pylibbpf/ir_to_ctypes.py
@@ -22,9 +22,14 @@ def ir_type_to_ctypes(ir_type):
22
23
elif isinstance(ir_type, ir.ArrayType):
24
count = ir_type.count
25
- element_type = ir_type_to_ctypes(ir_type.element)
26
- return element_type * count
27
-
+ element_type_ir = ir_type.element
+
+ if isinstance(element_type_ir, ir.IntType) and element_type_ir.width == 8:
28
+ # Use c_char for string fields (will have .decode())
29
+ return ctypes.c_char * count
30
+ else:
31
+ element_type = ir_type_to_ctypes(element_type_ir)
32
+ return element_type * count
33
elif isinstance(ir_type, ir.PointerType):
34
return ctypes.c_void_p
35
0 commit comments