Re: Issue eBPF kernel programs with ldc?

2025-01-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 06/01/2025 5:27 AM, data pulverizer wrote: @(ldc.attributes.section("xdp_md")) struct xdp_md { I don't understand why you gave a type declaration a section. Its not done on the C side. https://github.com/libbpf/libbpf/blob/c5f22aca0f3aa855daa159b2777472b35e721804/include/uapi/linux/bpf.h#L

Re: Secure dependency management

2025-01-05 Thread evilrat via Digitalmars-d-learn
On Monday, 6 January 2025 at 03:04:40 UTC, Chris Piker wrote: Here's what I ended up doing in case it's either useful for others, or a really bad idea and serves as an anti-example. 0) For context, the working directory has roughly this setup (after git submodule calls): ``` git-root |-- mai

Re: Secure dependency management

2025-01-05 Thread Chris Piker via Digitalmars-d-learn
Here's what I ended up doing in case it's either useful for others, or a really bad idea and serves as an anti-example. 0) For context, the working directory has roughly this setup (after git submodule calls): ``` git-root |-- main_project |-- deps/ ||-- vibe-serialization ||-- ...

meson unittest

2025-01-05 Thread sfp via Digitalmars-d-learn
Anyone have a good way of yanking out all `unittest { ... }` blocks from a library compiled using Meson? It would be nice to approximate what dub does. Meson has mentions this trick in its help docs (https://mesonbuild.com/D.html#using-embedded-unittests) but it isn't particularly useful. I h

Re: Secure dependency management

2025-01-05 Thread Chris Piker via Digitalmars-d-learn
On Sunday, 5 January 2025 at 06:21:15 UTC, evilrat wrote: If your project can't take the risk of losing online dependencies you might just want to put and commit them under your project's version control system That's nice and simple, so maybe a good idea, but it does make it more difficult t

Re: Issue eBPF kernel programs with ldc?

2025-01-05 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 5 January 2025 at 14:27:57 UTC, Richard (Rikki) Andrew Cattermole wrote: On 06/01/2025 3:17 AM, data pulverizer wrote: long bpf_trace_printk(const(char)* fmt, uint fmt_size, ...); libbpf: failed to find BTF for extern 'bpf_trace_printk': -2 Compare your D definition against: `

Re: Simplify some C-style code

2025-01-05 Thread Christian Köstlin via Digitalmars-d-learn
On Wednesday, 25 December 2024 at 07:49:28 UTC, sfp wrote: I have some code like this: ``` enum DomainType { Ball, Box, CsgDiff } struct Domain(int Dim) { DomainType type; union { Ball!Dim ball; Box!Dim box; CsgDiff!Dim csgDiff; } this(Ball!Dim ball) { this.type =

Re: Issue eBPF kernel programs with ldc?

2025-01-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 06/01/2025 3:17 AM, data pulverizer wrote: long bpf_trace_printk(const(char)* fmt, uint fmt_size, ...); libbpf: failed to find BTF for extern 'bpf_trace_printk': -2 Compare your D definition against: ```c static long (* const bpf_trace_printk)(const char *fmt, __u32 fmt_size, ...) = (

Issue eBPF kernel programs with ldc?

2025-01-05 Thread data pulverizer via Digitalmars-d-learn
# Issue eBPF kernel programs with ldc? I have been trying to get eBPF kernel programs running with D on the LDC compiler. The object file generated by the LDC compiler fails when attempting to run it with the loader/user program because of an undefined reference to a BPF function, however the