feat: implement extern libs data writing

This commit is contained in:
samsonium
2026-11-05 18:40:02 +03:00
parent d91ba3d63a
commit 84572edb0d
8 changed files with 279 additions and 23 deletions
+30
View File
@@ -0,0 +1,30 @@
#include <common/fzl_extern.h>
#include <compiler/internals/writer.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
// Writer external lib names
bool wr_extern_libs(FILE *fd, fzl_extern_lib_t *libs, size_t libs_count)
{
if (!fd || !libs)
return false;
for (size_t i = 0; i < libs_count; i++)
{
fzl_extern_lib_t *lib = &libs[i];
if (!lib || !lib->name)
return false;
size_t len = strlen(lib->name);
if (len < 1)
return false;
fwrite(&len, sizeof(size_t), 1, fd);
fwrite(lib->name, sizeof(char), len, fd);
}
return true;
}