#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL.h"
Go to the source code of this file.
|
typedef int(* | fntype) (const char *) |
|
|
int | main (int argc, char *argv[]) |
|
◆ fntype
typedef int(* fntype) (const char *) |
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 25 of file testloadso.c.
26{
28 int hello = 0;
29 const char *libname =
NULL;
30 const char *symname =
NULL;
33
34 if (argc != 3) {
35 const char *app = argv[0];
36 SDL_Log(
"USAGE: %s <library> <functionname>\n", app);
37 SDL_Log(
" %s --hello <lib with puts()>\n", app);
38 return 1;
39 }
40
41
44 return 2;
45 }
46
47 if (strcmp(argv[1], "--hello") == 0) {
48 hello = 1;
49 libname = argv[2];
50 symname = "puts";
51 } else {
52 libname = argv[1];
53 symname = argv[2];
54 }
55
61 } else {
67 } else {
68 SDL_Log(
"Found %s in %s at %p\n", symname, libname, fn);
69 if (hello) {
70 SDL_Log(
"Calling function...\n");
71 fflush(stdout);
72 fn(" HELLO, WORLD!\n");
73 SDL_Log(
"...apparently, we survived. :)\n");
74 SDL_Log(
"Unloading library...\n");
75 fflush(stdout);
76 }
77 }
79 }
82}
void * SDL_LoadFunction(void *handle, const char *name)
@ SDL_LOG_CATEGORY_APPLICATION
int(* fntype)(const char *)
References NULL, retval, SDL_GetError, SDL_Init, SDL_LoadFunction(), SDL_LoadObject, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LogError, SDL_Quit, and SDL_UnloadObject.