rename clang folder, add clang before main scripts, update guide

main
Allen Webster 2024-04-24 07:31:32 -07:00
parent 68e02cc9a6
commit 5c44c148cd
5 changed files with 43 additions and 12 deletions

View File

@ -7,20 +7,24 @@ layer, plugin, and main program.
The examples: The examples:
*_linking - Concrete examples for each operating system I have investigated *_linking - Concrete examples for each operating system showing how to
showing how to setup and use various types of dynamic linking. In setup and use various types of dynamic linking. In these
these the "base" layer goes through load-time linking, the the "base" layer uses load-time linking, the "plugin" layer uses
"plugin" layer goes through run-time linking, and the "main" layer run-time linking, and the "main" layer acts as the executable that
acts as the executable that must bind it all together. binds it all together into a process.
clang_linking - Build scripts that build the *_linking examples with clang. *_before_main - Concrete examples for each operating system showing how to
Clang does not require changes to the source in either case. create a function that runs before main.
The build lines require some modification on Windows.
On Linux clang can be directly swapped out for gcc. clang - Build scripts that build the concrete examples with clang instead of
cl or gcc. In each case clang can build the same source. In some cases
clang on windows can even build the linux source. The build lines for
clang that replace cl require some modification. The build lines for
clang that replace gcc have the exact same flags and inputs.
xlist - My prefered solution to the problem posed in the investigation which xlist - My prefered solution to the problem posed in the investigation which
relies only on run-time linking. It uses an xlist to manage the relies only on run-time linking & before-main execution. It uses an
maintenance burden of run-time linking, and a basic outline of the xlist to manage the maintenance burden of run-time linking, and a
abstracted form of each layer. basic outline of the abstracted form of the base layer.

View File

@ -0,0 +1,13 @@
#!/bin/bash
# Path setup
cd ../linux_before_main
src=$PWD
cd ..
mkdir -p build
cd build
# Build
clang -fvisibility=hidden $src/linux_before_main.c -o linux_before_main

View File

@ -0,0 +1,14 @@
@echo off
REM: Path setup
cd ..\win32_before_main
SET src=%cd%
cd ..
if not exist "build\" mkdir build
cd build
REM: Build
clang %src%\win32_before_main.c