diff options
author | 2024-09-26 21:02:12 +0100 | |
---|---|---|
committer | 2024-09-28 18:28:13 +0100 | |
commit | 3503fa80c02e19a718245f92eba31f6b0a5cf45c (patch) | |
tree | e1e1d5913d4cf3ddb07dff7f42c5176447daa5d2 /compile.bat | |
parent | bc9198ba9b654117118a06399d4dbf273262501d (diff) | |
download | sst-3503fa80c02e19a718245f92eba31f6b0a5cf45c.tar.gz sst-3503fa80c02e19a718245f92eba31f6b0a5cf45c.zip |
Enable rebuilding the plugin while it is loaded
Diffstat (limited to 'compile.bat')
-rw-r--r-- | compile.bat | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/compile.bat b/compile.bat index 11d0aac..1eebb59 100644 --- a/compile.bat +++ b/compile.bat @@ -137,10 +137,27 @@ if "%dbg%"=="1" ( )
%CC% -fuse-ld=lld -shared -flto %ldflags% -Wl,/IMPLIB:.build/sst.lib,/Brepro,/nodefaultlib ^
-L.build %clibs% -lkernel32 -luser32 -lbcryptprimitives -lshlwapi -ld3d9 -ldsound ^
--ltier0 -lvstdlib -lntdll -o sst.dll%objs% .build/dll.res || goto :end
+-ltier0 -lvstdlib -lntdll -o .build/sst.dll%objs% .build/dll.res || goto :end
:: get rid of another useless file (can we just not create this???)
del .build\sst.lib
+:: awkward logic to replace sst.dll while it's potentially loaded, because
+:: windows likes to lock things and/or doesn't have atomic rename.
+:: very TOCTOU-ish code, not good at all, but sometimes bad is good enough
+move /y .build\sst.dll sst.dll >nul 2>nul || (
+ move /y sst.dll .build\sst.old.dll >nul 2>nul || (
+ echo:ERROR: couldn't remove sst.dll OR .build/sst.old.dll - are both loaded?>&2
+ goto :end
+ )
+ move .build\sst.dll sst.dll >nul 2>nul || (
+ echo:ERROR: couldn't replace sst.dll - did something just try to load it?>&2
+ goto :end
+ )
+)
+:: try to cleanup the .old again - it'll fail if we just moved it but may work
+:: in some eventual future invocation
+if exist .build\sst.old.dll del .build\sst.old.dll >nul 2>nul
+
%HOSTCC% -fuse-ld=lld -O2 -g -include test/test.h -o .build/bitbuf.test.exe test/bitbuf.test.c || goto :end
.build\bitbuf.test.exe || goto :end
:: special case: test must be 32-bit
|