call functions from dynamic shared object files
git clone http://git/dlcall
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
extern uint8_t uadd2(uint8_t a, uint8_t b) {
return a+b;
}
extern uint8_t uadd3(uint8_t a, uint8_t b, uint8_t c) {
return a+b+c;
}
extern uint8_t uadd4(uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
return a+b+c+d;
}
extern int8_t iadd2(int8_t a, int8_t b) {
return a+b;
}
extern int8_t iadd3(int8_t a, int8_t b, int8_t c) {
return a+b+c;
}
extern int8_t iadd4(int8_t a, int8_t b, int8_t c, int8_t d) {
return a+b+c+d;
}
extern char* bytes(size_t i) {
char *out = malloc(i);
for (int j = 0; j < i; j++) {
out[j] = j%256;
}
return out;
}
extern void write(char *out, size_t i) {
for (int j = 0; j < i; j++) {
out[j] = j%256;
}
}
extern char* uc(char *lc) {
size_t len = strlen(lc);
char *out = malloc(len);
for (int i = 0; i < len; i++) {
unsigned char c = lc[i];
out[i] = c >= 97 && c <= 122 ? c - 32 : c;
}
return out;
}