code wiki / _hdl_build / nx_pe_dll_emit_gate.nx
nx_pe_dll_emit_gate.nx
buildroot/runtime/_hdl_build/nx_pe_dll_emit_gate.nx
about
nx_pe_dll_emit_gate.nx -- WINDOWS-NATIVE CRUX: emit a sovereign PE *DLL with a named export* that a FOREIGN Windows
process can LoadLibrary + GetProcAddress + call. This is the mechanism a Steam game needs: it loads d3d11.dll and
calls its exports, so our lib must be a loadable DLL a foreign binary can bind. Here we prove the loadability path
end to end with a minimal export (nishi_add(a,b)=a+b). No DllMain (AddressOfEntryPoint=0 -> loader binds directly).
Based at 0x180000000 so it never collides with the harness .exe (default 0x140000000); code is position-independent.
100% NishiLang PE bytes; a C harness (benchmark oracle, like WARP/fxc) is the external verifier. license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 9 | func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 10 | func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 } |
| 11 | func px2(v: i64) -> i64 { let d: *u8="0123456789abcdef" as *u8; let b: *u8=sys_mmap(4) as *u8; b[0]=d[(v>>4)&15]; b[1]=d[v&15]; sys_write(1,b,2); return 0 } |
| 13 | func w8(buf: *u8, off: i64, v: i64) -> i64 { buf[off] = (v & 255) as u8; return 0 } called by 1: main |
| 14 | func w16(buf: *u8, off: i64, v: i64) -> i64 { buf[off]=(v&255) as u8; buf[off+1]=((v>>8)&255) as u8; return 0 } called by 1: main |
| 15 | func w32(buf: *u8, off: i64, v: i64) -> i64 { buf[off]=(v&255) as u8; buf[off+1]=((v>>8)&255) as u8; buf[off+2]=((v>>16)&255) as u8; buf[off+3]=((v>>24)&255) as u8; return 0 } called by 1: main |
| 16 | func wstr(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ buf[off+i]=s[i]; i=i+1 } buf[off+i]=0 as u8; return i+1 } called by 1: main |
| 18 | func main() -> i64 |