comparison test/testloadso.c @ 2068:f16a7d02a176

Merged r2901:2902 from SDL-1.2 branch to trunk: printf stupidity fixes.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 07 Nov 2006 15:02:12 +0000
parents dcdb175c2829
children 2c835d58faad
comparison
equal deleted inserted replaced
2067:dcdb175c2829 2068:f16a7d02a176
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");