dystruct:Dystruct 可以在运行时轻松创建 C 结构

时间:2021-06-23 15:05:25
【文件属性】:
文件名称:dystruct:Dystruct 可以在运行时轻松创建 C 结构
文件大小:44KB
文件格式:ZIP
更新时间:2021-06-23 15:05:25
C 破坏结构 抽象的 Dystruct 是一个小型 C 库,可让您在运行时轻松构建自己的 C 结构。 例如,如果您不知道必须将哪种结构传递给动态调用的函数(使用 libffi),则必须在运行时在堆上构建它们。 这个库在处理成员的正确对齐要求的同时做到了这一点。 介绍 作为用例示例,请考虑以下代码: struct flat { int a; double b; char c; }; [...] int do_sth(void){ struct flat *s = malloc(sizeof(struct flat)); s->a = 42; s->b = 424242.424242 s->c = '*'; return 0; } s 指向的结构现在位于堆上,如下所示: Offset: 0 1 2 3 4
【文件预览】:
dystruct-master
----.gitignore(333B)
----COPYING(34KB)
----README.md(6KB)
----test()
--------dstru_test.c(12KB)
--------dstru_test_types.h(2KB)
--------dstru_test_funcs.h(2KB)
--------Makefile.am(210B)
----INSTALL(15KB)
----LICENSE(1KB)
----include()
--------dstru_util_funcs.h(1KB)
--------dstru_types.h(2KB)
--------dstru_funcs.h(4KB)
--------dstru_defines.h(2KB)
--------Makefile.am(98B)
----ChangeLog(677B)
----AUTHORS(50B)
----src()
--------dstru.c(9KB)
--------dstru_util.c(2KB)
--------Makefile.am(303B)
----configure.ac(4KB)
----scripts()
--------dev-al.sh(209B)
----config()
--------config.h.in(4KB)
----README(6KB)
----NEWS(4B)
----Makefile.am(52B)

网友评论