From 86eb22bbf380c14ddadc4b193090c9831d6db3c9 Mon Sep 17 00:00:00 2001 From: occheung Date: Tue, 12 Nov 2024 12:03:38 +0800 Subject: [PATCH] artiq: main is always the last module --- nac3artiq/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nac3artiq/src/lib.rs b/nac3artiq/src/lib.rs index 3ffc9d9f1..e66c9d7c3 100644 --- a/nac3artiq/src/lib.rs +++ b/nac3artiq/src/lib.rs @@ -764,9 +764,12 @@ impl Nac3 { // Link all modules into `main`. let buffers = membuffers.lock(); let main = context - .create_module_from_ir(MemoryBuffer::create_from_memory_range(&buffers[0], "main")) + .create_module_from_ir(MemoryBuffer::create_from_memory_range( + &buffers.last().unwrap(), + "main", + )) .unwrap(); - for buffer in buffers.iter().skip(1) { + for buffer in buffers.iter().rev().skip(1) { let other = context .create_module_from_ir(MemoryBuffer::create_from_memory_range(buffer, "main")) .unwrap();