Hi,
I'm making a library tester for my C library. I'd like to be able to detect which function have been implemented yet in the archive (.a) file. The goal would be to use this information to skip compiling the tests for the functions that do not exists yet and thus avoiding the builder to crash because it can't link them.
I found that nm mylib.a -f 'just-symbols' is the perfect command just for that, but I can't find a way to get this command's output during the build process.
For now I have this:
var get_function_list = b.addSystemCommand(&[_][]const u8{ "nm", libft_archive_path, "-f", "just-symbols" });
_ = get_function_list.captureStdOut();
exe.step.dependOn(&get_function_list.step);
const exe_options = b.addOptions();
exe_options.addOption([]const u8, "libft-path", libft_path);
exe_options.addOption([]const u8, "function-list", if (get_function_list.captured_stdout) |out| out.basename else "something");
exe.root_module.addOptions("config", exe_options);
It does run the command but I can't find a way to read the output at the time I need it to.
Thanks for reading !
P.S: If there is a direct way to detect if a function is defined or not it would be much better !