@echo off
echo ----- Building DLLs -----
set PATH=D:\D\dmd2head\windows\bin;%PATH%
for /l %%i in (1,1,3) do (
    dmd dllmain.d printtlsinfo.d -version=dll%%i -ofDDynamicLib%%iDef.dll -L/IMPLIB:DDynamicLib%%iDef.lib DDynamicLib%%i.def || echo Error && pause
    dmd dllmain.d printtlsinfo.d -version=dll%%i -ofDDynamicLib%%iNoDef.dll -L/IMPLIB:DDynamicLib%%iNoDef.lib || echo Error && pause
)

echo ----- Testing -----
dmd -of"dllUserStaticDef".exe main.d printtlsinfo.d DDynamicLib1Def.lib DDynamicLib2Def.lib DDynamicLib3Def.lib || echo Error && pause
dllUserStaticDef || echo Error && pause
dmd -of"dllUserDynamicDef".exe main.d printtlsinfo.d -version=dynamicDll || echo Error && pause
dllUserDynamicDef || echo Error && pause

dmd -of"dllUserStaticNoDef".exe main.d printtlsinfo.d -version=NoDef DDynamicLib1NoDef.lib DDynamicLib2NoDef.lib DDynamicLib3NoDef.lib || echo Error && pause
dllUserStaticNoDef || echo Error && pause
dmd -of"dllUserDynamicNoDef".exe main.d printtlsinfo.d -version=dynamicDll -version=NoDef || echo Error && pause
dllUserDynamicNoDef || echo Error && pause

del *.obj && del *.lib
echo ----- Done ----- && pause
