i want to create an application that has 0 dlls linked to it, at least on windows.
but at the same time i still need the dlls to be loaded after the application is launched. position independence.
with these circumstances, i can optionally have code that can be loaded into memory directly, this could be great for protecting my application from reverse engineering. shellcode.
how hard would it be to basically define my own std functions, i.e swapping out the functions that are dynamically linked, with functions loaded at runtime. like WriteFile for instance. possibly i could make this my own std lib and use it with any project
this would allow me to compile my code into an exe, but 0 dlls would show up in dependency walker
Just FIY, doing this won’t help your with security at all. Dependency Walker also keeps track of modules loaded at runtime, and in reverse engineering, it is trivial to se what modules are loaded and to break on a cross module call.
zigs goal is to be portable and dependency-less correct? why wasn’t position independence ever considered, with that, you can have the up most power over the system
nah, i know, but it will unlock the possibility of making compilation available as shellcode, i know i can load the pe into memory but that’s more of a overhead
You can enable position-independence in the build system.
But this has nothing to do with loading DLLs. The DLL has to be position independent, but an executable may or may not be position independent, and this has no effect on it loading modules.
I think he’s looking to create position-independent code that does not rely on relocation. Just load it into memory and it’ll work (like shellcode). As far as I know that’s not possible with modern CPUs.
Here’s some code I wrote years ago. The function loads and statically links a .obj file so it’s not completely applicable to your use case. But it should give you some idea on what’s involved.