test-on-exit.c 218 字节
Newer Older
1 2
#include <stdio.h>

3 4 5 6 7 8 9
static void exit_fn(int status, void *__data)
{
	printf("exit status: %d, data: %d\n", status, *(int *)__data);
}

static int data = 123;

10 11
int main(void)
{
12 13 14
	on_exit(exit_fn, &data);

	return 321;
15
}