1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-05 13:30:22 +00:00
QB64-PE/tests/compile_tests/declare_library_static/test.bas
github-actions[bot] 72d801e0cd Fix linking static libraries on Windows
In QB64, when linking with an external static library `nm.exe` is used
to determine whether the symbol being used is either a C or C++ symbol,
which determines how the function should be declared in the C++ code.

Unfortunately on Windows the `SHELL` command for `nm.exe` is missing the
`cmd /c`, which means the redirection does not work and consequently
we're unable to find the function declaration via `nm.exe`, which causes
the compilation to fail.

In addition to fixing this, I added tests for `DECLARE STATIC LIBRARY`
for all supported platforms.

Fixes: #112
2022-07-09 14:59:33 -04:00

36 lines
603 B
QBasic

$CONSOLE:ONLY
$IF WIN THEN
$IF 32BIT THEN
DECLARE STATIC LIBRARY "./lib-windows32"
FUNCTION add_values&(BYVAL v1 AS LONG, BYVAL v2 as LONG)
END DECLARE
$ELSE
DECLARE STATIC LIBRARY "./lib-windows"
FUNCTION add_values&(BYVAL v1 AS LONG, BYVAL v2 as LONG)
END DECLARE
$END IF
$ELSEIF MAC THEN
DECLARE STATIC LIBRARY "./lib-osx"
FUNCTION add_values&(BYVAL v1 AS LONG, BYVAL v2 as LONG)
END DECLARE
$ELSEIF LINUX THEN
DECLARE STATIC LIBRARY "./lib-linux"
FUNCTION add_values&(BYVAL v1 AS LONG, BYVAL v2 as LONG)
END DECLARE
$END IF
result = add_values&(2, 3)
PRINT result
SYSTEM