// core.c #include #include #define SDL_MAIN_HANDLED #include #define SHARED_OBJECT "ampler.dll" #define SHARED_MAIN "ampler_main" #define SHARED_OBJECT_ACTIVE SHARED_OBJECT "-active.dll" int main(int argc, char **argv) { puts("start."); SDL_Init(SDL_INIT_EVERYTHING); SDL_Window *w; SDL_Renderer *r; w = SDL_CreateWindow("core", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 480, 480, SDL_WINDOW_RESIZABLE); r = SDL_CreateRenderer(w, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE); //SDL_CreateWindowAndRenderer( // 1080, 480, SDL_WINDOW_RESIZABLE, &w, &r); void *u_data = NULL; while (1) { if (system("copy " SHARED_OBJECT " " SHARED_OBJECT_ACTIVE " /Y")) { puts("failed copying to " SHARED_OBJECT_ACTIVE); // puts(SDL_GetError()); break; } void *so = SDL_LoadObject(SHARED_OBJECT_ACTIVE); if (so == 0) { puts("failed load " SHARED_OBJECT_ACTIVE); puts(SDL_GetError()); break; } int(*shared_main)(SDL_Window *, SDL_Renderer *, void **) = SDL_LoadFunction(so, SHARED_MAIN); if(shared_main(w, r, &u_data)) break; SDL_UnloadObject(so); } quit: SDL_DestroyRenderer(r); SDL_DestroyWindow(w); SDL_Quit(); return 0; }