mirror of
https://github.com/fluencelabs/c-template
synced 2025-04-25 06:32:14 +00:00
fix bug with side modules macro and add more comments
This commit is contained in:
parent
460d09a911
commit
145771bbfd
@ -44,7 +44,7 @@ char * module_name ## _call(const char *ptr, int length) { \
|
|||||||
\
|
\
|
||||||
unsigned int result_size = 0; \
|
unsigned int result_size = 0; \
|
||||||
for (int i = 0; i < 4; ++i) { \
|
for (int i = 0; i < 4; ++i) { \
|
||||||
result_size = result_size | ((unsigned int)result[i] << 8*i); \
|
result_size = result_size | (module_name ## _load(result + i) << 8*i); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
char *result_out = malloc(result_size + 1); \
|
char *result_out = malloc(result_size + 1); \
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/// Some syscalls could be as the result of importing files like stdio.h that in its turn imports standart I/O
|
||||||
|
/// descriptors like stdin/stderr/stdout. Each of them is a structure contains some callbacks (e.g.
|
||||||
|
/// https://github.com/CraneStation/wasi-libc/blob/9bb4cc5c411af8453cbef69c137a4c2337714d89/libc-top-half/musl/src/stdio/stdin.c#L11)
|
||||||
|
/// These stubs could provide default implementations for syscalls. And please include this file, if you are sure
|
||||||
|
/// that these syscalls couldn't be used directly.
|
||||||
|
|
||||||
size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) {
|
size_t __stdio_write(FILE *f, const unsigned char *buf, size_t len) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user