diff --git a/linux_clang/build.sh b/linux_clang/build.sh new file mode 100644 index 0000000..7967b36 --- /dev/null +++ b/linux_clang/build.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Path setup +cd ../linux_concrete +src=$PWD +cd .. +mkdir -p build +cd build + + +#### THE ARRANGEMENT OF THIS BUILD #### +# The "base layer" must be built and shared by all dynamic components. +# In this example the the base layer is linked via load-time linking with the other modules. +# The "plugin" is loaded at run-time. + + +# Build the base layer as a .so +clang -fvisibility=hidden -fPIC -shared $src/linux_base.c -o linux_base.so + + +# Build the executable; provide the base layer's load-time linking data via linux_base.so +clang -fvisibility=hidden $src/linux_main.c linux_base.so -o linux_main -Wl,-rpath,\$ORIGIN/ + + +# Build the plugin as a .so; provide the base layer's load-time linking data via linux_base.so +clang -fvisibility=hidden -fPIC -shared $src/linux_plugin.c linux_base.so -o linux_plugin.so -Wl,-rpath,\$ORIGIN/ + diff --git a/win32_clang/build.bat b/win32_clang/build.bat new file mode 100644 index 0000000..4227176 --- /dev/null +++ b/win32_clang/build.bat @@ -0,0 +1,29 @@ +@echo off + +REM: Path setup + +cd ..\win32_concrete +SET src=%cd% +cd .. +if not exist "build\" mkdir build +cd build + + +REM: ### THE ARRANGEMENT OF THIS BUILD ### +REM: The "base layer" must be built and shared by all dynamic components. +REM: In this example the the base layer is linked via load-time linking with the other modules. +REM: The "plugin" is loaded at run-time. + + + +REM: Build the base layer as a .dll (also produces load-time linking data in win32_base.lib) +clang -shared %src%\win32_base.c -o win32_base.dll + + +REM: Build the executable; provide the base layer's load-time linking data via win32_base.lib +clang %src%\win32_main.c win32_base.lib -o win32_main.exe + + +REM: Build the plugin as a .dll; provide the base layer's load-time linking data via win32_base.lib +clang -shared %src%\win32_plugin.c win32_base.lib -o win32_plugin.dll + diff --git a/win32_concrete/build.bat b/win32_concrete/build.bat index 2bfbb0a..3e9ec9b 100644 --- a/win32_concrete/build.bat +++ b/win32_concrete/build.bat @@ -16,13 +16,13 @@ REM: The "plugin" is loaded at run-time. REM: Build the base layer as a .dll (also produces load-time linking data in win32_base.lib) -cl /nologo /Zi /LD %src%\win32_base.c +cl /nologo /LD %src%\win32_base.c REM: Build the executable; provide the base layer's load-time linking data via win32_base.lib -cl /nologo /Zi %src%\win32_main.c win32_base.lib +cl /nologo %src%\win32_main.c win32_base.lib REM: Build the plugin as a .dll; provide the base layer's load-time linking data via win32_base.lib -cl /nologo /Zi /LD %src%\win32_plugin.c win32_base.lib +cl /nologo /LD %src%\win32_plugin.c win32_base.lib