USING: alien.inline.syntax alien.marshall.syntax alien.syntax tools.test kernel accessors alien fry math namespaces ; IN: pthreads DELETE-C-LIBRARY: test C-LIBRARY: test C-INCLUDE: C-INCLUDE: C-INCLUDE: CM-STRUCTURE: thread_info { "int" "cside" } { "int" "fside" } ; RAW-C: thread_info info; char* run_me(void* x, void* y) { void* (*a) (void*) = (void* (*) (void*)) x; void* (*b) (void*) = (void* (*) (void*)) y; info.cside = 0; info.fside = 0; pthread_t a_id, b_id; pthread_create(&a_id, NULL, a, &info); pthread_create(&b_id, NULL, b, &info); pthread_join(a_id, NULL); pthread_join(b_id, NULL); char* out = malloc(32 * sizeof(char)); sprintf(out, "c %i f %i", info.cside, info.fside); return out; } ; ;C-LIBRARY FUNCTION: char* run_me ( void* x, void* y ) ; SYMBOL: x : fa ( -- alien ) "void*" { "void*" } "cdecl" [ \ thread_info new swap >>underlying dup '[ _ [ 1+ ] change-cside drop x inc ] 100 swap times x get >>fside drop f ] alien-callback ; : fb ( -- alien ) "void*" { "void*" } "cdecl" [ \ thread_info new swap >>underlying dup '[ _ [ 1- ] change-cside drop x dec ] 100 swap times x get >>fside drop f ] alien-callback ; ! fa fb run_me => The image refers to a library or symbol that was not found at load time