int mult (int x, int y); void speak (const char* str); unsigned char* arr (); #### #include #include int mult (int x, int y){ return x * y; } void speak (const char* str){ printf("%s\n", str); } unsigned char* arr (){ unsigned char* list = malloc(sizeof(unsigned char) * 3); int i; for (i=0; i<3; i++){ list[i] = i; } return list; } #### #include #include "xswrap.h" int main (){ int ret = mult(5, 5); printf("%d\n", ret); speak("hello, world!"); unsigned char* list = arr(); int i; for (i=0; i<3; i++){ printf("%d\n", list[i]); } return 0; } #### #!/bin/sh gcc -c -fPIC xswrap.c gcc -shared -fPIC -Wl,-soname,libxswrap.so -o libxswrap.so xswrap.o -lc sudo cp libxswrap.so /usr/lib sudo cp xswrap.h /usr/local/include #### gcc -o test main.c -lxswrap #### ./test