I have been trying to do Dynamic Loading but an getting an error:
./handmade.dll: only ET_DYN and ET_EXEC can be loaded
Here is my loading code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | struct sdl_game_code { void *GameCodeDLL; game_update_and_render *UpdateAndRender; bool32 IsValid; }; internal sdl_game_code SDLLoadGameCode(){ sdl_game_code Result = {}; Result.UpdateAndRender = GameUpdateAndRenderStub; Result.GameCodeDLL = dlopen("./handmade.dll", RTLD_LAZY); if (!Result.GameCodeDLL) { fputs (dlerror(), stderr); } Result.UpdateAndRender = (game_update_and_render *)dlsym(Result.GameCodeDLL, "GameUpdateAndRender"); return Result; } |
Thanks!