set tmpdir tmpdir
proc test_direct2_link_dll_def {} {
- global CC
- global CFLAGS
+ global CC_FOR_TARGET
+ global CFLAGS_FOR_TARGET
global srcdir
global subdir
global tmpdir
# Compile the dll.
- if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct2_dll.c $tmpdir/direct2_dll.o ] {
+ if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct2_dll.c $tmpdir/direct2_dll.o ] {
fail "compiling shared lib fastcall/stdcall"
- } elseif ![ld_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o $srcdir/$subdir/direct2_dll.def" ] {
+ } elseif ![ld_link "$CC_FOR_TARGET -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.dll "$tmpdir/direct2_dll.o $srcdir/$subdir/direct2_dll.def" ] {
fail "linking shared lib (.dll) fastcall/stdcall"
- } elseif ![ld_link "$CC -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.sl "$tmpdir/direct2_dll.o $srcdir/$subdir/direct2_dll.def" ] {
+ } elseif ![ld_link "$CC_FOR_TARGET -shared -Wl,--enable-stdcall-fixup -Wl,--kill-at " $tmpdir/direct2_dll.sl "$tmpdir/direct2_dll.o $srcdir/$subdir/direct2_dll.def" ] {
fail "linking shared lib (.sl) fastcall/stdcall"
} else {
# Compile and link the client program.
- if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/direct2_client.c $tmpdir/direct2_client.o ] {
+ if ![ld_compile "$CC_FOR_TARGET $CFLAGS_FOR_TARGET" $srcdir/$subdir/direct2_client.c $tmpdir/direct2_client.o ] {
fail "compiling client fastcall/stdcall"
} else {
# Check linking to import library.
set msg "linking client (.dll) fastcall/stdcall"
- if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \
+ if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \
"$tmpdir/direct2_client.o -L$tmpdir -ldirect2_dll" ] {
pass $msg
} else {
# Check linking directly to direct2_dll.dll.
set msg "linking client (.dll) fastcall/stdcall"
- if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \
+ if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_dll.exe \
"$tmpdir/direct2_client.o $tmpdir/direct2_dll.dll" ] {
pass $msg
} else {
# Check linking directly to direct2_dll.sl.
set msg "linking client (.sl) fastcall/stdcall"
- if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_sl.exe \
+ if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_sl.exe \
"$tmpdir/direct2_client.o $tmpdir/direct2_dll.sl" ] {
pass $msg
} else {
# Create symbolic link.
catch "exec ln -fs direct2_dll.dll $tmpdir/libdirect2_dll.dll.a" ln_catch
set msg "linking client (symlink -> .dll) fastcall/stdcall"
- if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_dll.exe \
+ if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_dll.exe \
"$tmpdir/direct2_client.o $tmpdir/libdirect2_dll.dll.a" ] {
pass $msg
} else {
# Create symbolic link.
catch "exec ln -fs direct2_dll.sl $tmpdir/libdirect2_sl.dll.a" ln_catch
set msg "linking client (symlink -> .sl) fastcall/stdcall"
- if [ld_link "$CC $CFLAGS -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_sl.exe \
+ if [ld_link "$CC_FOR_TARGET $CFLAGS_FOR_TARGET -Wl,--enable-stdcall-fixup -Wl,--enable-auto-import" $tmpdir/direct2_client_symlink_sl.exe \
"$tmpdir/direct2_client.o $tmpdir/libdirect2_sl.dll.a" ] {
pass $msg
} else {