1 #include <stdio.h> 2 3 #ifdef _MSC_VER 4 # define DLLIMPORT __declspec(dllimport) 5 #else 6 # define DLLIMPORT extern 7 #endif 8 9 DLLIMPORT int add_rec(int, int); 10 DLLIMPORT int (*my_callback)(int); 11 some_callback(int x)12static int some_callback(int x) 13 { 14 printf("some_callback(%d)\n", x); 15 fflush(stdout); 16 return add_rec(x, 9); 17 } 18 main(void)19int main(void) 20 { 21 int x, y; 22 my_callback = some_callback; 23 x = add_rec(40, 2); 24 y = add_rec(100, -5); 25 printf("got: %d %d\n", x, y); 26 return 0; 27 } 28