Skip to content

Commit a2e8bb5

Browse files
committed
build.*: switch to DllMain in cpuid.c.
1 parent 4748e66 commit a2e8bb5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

build.bat

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
SETLOCAL
33
set PATH=%windir%\system32;%PATH% &:: override msys if it's on the PATH
44
set TOP=%~dp0
5-
cl /nologo /c /O2 /Zi /Fdblst.pdb /W4 /MT /Zl %TOP%src\server.c || EXIT /B
5+
set CFLAGS=/nologo /c /O2 /Zi /Fdblst.pdb /W4
66
cl 2>&1 | find "for ARM64" > nul:
77
IF ERRORLEVEL 1 (
88
set arm64=no
@@ -23,14 +23,16 @@ FOR %%O IN (%*) DO (
2323
set opt=%%O
2424
IF "!opt!" == "-shared" (
2525
IF [!shared!] EQU [] set shared=/out:blst.dll
26+
) ELSE IF "!opt!" == "-dll" (
27+
IF [!shared!] EQU [] set shared=/out:blst.dll
2628
) ELSE IF "!opt:~0,5!" == "/out:" (
2729
IF "!opt:~-4!" == ".dll" (set shared=!opt!) ELSE (set static=!opt!)
2830
) ELSE IF "!opt!" == "-arm64x" (
2931
set arm64x=%arm64%
3032
)
3133
)
3234
IF [%shared%] NEQ [] (
33-
cl /nologo /c /O2 /Oi- /MD %TOP%build\win64\dll.c || EXIT /B
35+
cl %CFLAGS% /MD /D__BLST_DLL_MAIN__ %TOP%src\server.c || EXIT /B
3436
set ld=
3537
FOR /F "usebackq delims=" %%F IN (`where link`) DO (
3638
IF "!ld!" == "" (
@@ -43,17 +45,17 @@ IF [%shared%] NEQ [] (
4345
/def:%TOP%build\win64\blst.def *.obj kernel32.lib && del *.obj
4446
) ELSE (
4547
lib /nologo /out:blst_arm64.lib *.obj && del *.obj || EXIT /B
46-
cl /nologo /arm64EC /c /O2 /Zi /Fdblst.pdb /W4 /MT /Zl %TOP%src\server.c || EXIT /B
4748
FOR %%F IN (%TOP%build\win64\*-armv8.asm) DO (
4849
armasm64 -nologo -machine arm64ec -nowarn %%F || EXIT /B
4950
)
50-
cl /nologo /arm64EC /c /O2 /Oi- /MD %TOP%build\win64\dll.c || EXIT /B
51+
cl /arm64EC %CFLAGS% /MD /D__BLST_DLL_MAIN__ %TOP%src\server.c || EXIT /B
5152
!ld! /nologo /machine:arm64x /dll /noentry %shared% ^
5253
/def:%TOP%build\win64\blst.def *.obj ^
5354
/defArm64Native:%TOP%build\win64\blst.def blst_arm64.lib ^
5455
kernel32.lib && del *.obj blst_arm64.lib
5556
)
5657
) ELSE (
58+
cl %CFLAGS% /MT /Zl %TOP%src\server.c || EXIT /B
5759
lib /nologo %static% *.obj && del *.obj
5860
)
5961
ENDLOCAL

build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ if [ -z "${flavour}" ]; then
8484
flavour=macosx
8585
elif echo ${predefs} | grep -q _WIN32; then
8686
flavour=mingw64
87+
if [ $shared ]; then
88+
cflags="$cflags -D__BLST_DLL_MAIN__"
89+
fi
8790
else
8891
flavour=elf
8992
fi
@@ -121,8 +124,7 @@ if [ $shared ]; then
121124
macosx) (set -x; ${CC} -dynamiclib -o libblst$dll.dylib \
122125
-all_load libblst.a ${CFLAGS}); exit 0;;
123126
mingw*) sharedlib="blst.dll ${TOP}/build/win64/blst.def"
124-
CFLAGS="${CFLAGS} -Wl,--entry=DllMain ${TOP}/build/win64/dll.c"
125-
CFLAGS="${CFLAGS} -nostartfiles";;
127+
CFLAGS="${CFLAGS} -Wl,--entry=DllMain -nostartfiles";;
126128
*) sharedlib=libblst$dll.so
127129
CFLAGS="${CFLAGS} -Wl,-Bsymbolic";;
128130
esac

0 commit comments

Comments
 (0)