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; } |
1 2 3 4 5 6 7 8 9 10 11 | #!/bin/sh cd ../bin CommonCompilerFlags="-std=c++14 -Wextra -Wno-writable-strings -Wno-missing-field-initializers -Wno-sign-compare -Wno-unused-parameter -Wno-null-dereference -Wno-c++11-compat-deprecated-writable-strings -DHANDMADE_INTERNAL -DHANDMADE_SLOW" LinkerFlags="-ldl `sdl2-config --cflags --libs`" clang++ $CommonCompilerFlags -c ../src/handmade.cpp -o handmadehero.dll -g $LinkerFlags clang++ $CommonCompilerFlags ../src/main.cpp -o handmadehero -g $LinkerFlags cd ../src |
1 | clang++ -shared $CommonCompilerFlags -c ../src/handmade.cpp -o handmadehero.dll -g |
1 2 | clang++ $CommonCompilerFlags -fPIC -c ../src/handmade.cpp clang++ -shared -o handmade.dll handmade.o |
1 | clang++ -shared -fpic $CommonCompilerFlags ../src/handmade.cpp -o handmadehero.dll -g |