comparison test/testloadso.c @ 3893:f1699aecb65d SDL-1.2

Man, who let this moron near printf()?! :)
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 07 Nov 2006 15:00:43 +0000
parents b25dd008167b
children 2c835d58faad
comparison
equal deleted inserted replaced
3892:b25dd008167b 3893:f1699aecb65d
17 const char *symname = NULL; 17 const char *symname = NULL;
18 void *lib = NULL; 18 void *lib = NULL;
19 fntype fn = NULL; 19 fntype fn = NULL;
20 20
21 if (argc != 3) { 21 if (argc != 3) {
22 fprintf(stderr, "USAGE: %s <library> <functionname>\n"); 22 const char *app = argv[0];
23 fprintf(stderr, " %s --hello <library with puts()>\n"); 23 fprintf(stderr, "USAGE: %s <library> <functionname>\n", app);
24 fprintf(stderr, " %s --hello <lib with puts()>\n", app);
24 return 1; 25 return 1;
25 } 26 }
26 27
27 /* Initialize SDL */ 28 /* Initialize SDL */
28 if ( SDL_Init(0) < 0 ) { 29 if ( SDL_Init(0) < 0 ) {
49 if (fn == NULL) { 50 if (fn == NULL) {
50 fprintf(stderr, "SDL_LoadFunction('%s') failed: %s\n", 51 fprintf(stderr, "SDL_LoadFunction('%s') failed: %s\n",
51 symname, SDL_GetError()); 52 symname, SDL_GetError());
52 retval = 4; 53 retval = 4;
53 } else { 54 } else {
54 printf("Found %s in %s at %p\n", symname, libname); 55 printf("Found %s in %s at %p\n", symname, libname, fn);
55 if (hello) { 56 if (hello) {
56 printf("Calling function...\n"); 57 printf("Calling function...\n");
57 fflush(stdout); 58 fflush(stdout);
58 fn(" HELLO, WORLD!\n"); 59 fn(" HELLO, WORLD!\n");
59 printf("...apparently, we survived. :)\n"); 60 printf("...apparently, we survived. :)\n");